1
我想創建一個用戶模型和行業模型的軌道4應用程序。他們之間有一個has_and_belongs_to_many關聯。我按照指南創建了連接表http://guides.rubyonrails.org/association_basics.html 我收到:industry_ids
的允許參數。所以我也跟着上strong parameters未經許可的參數中有和屬於很多協會
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :about
devise_parameter_sanitizer.for(:sign_up) << :industry_ids
end
end
的色器件部分但當我讀到這裏http://blog.sensible.io/2013/08/17/strong-parameters-by-example.html,用於關聯這樣我要告訴軌,這是一個數組。
如何解決使用:industries
關聯創建用戶的問題?