0
私はレール3.2.3を持っているが、私は私がフォームを送信しようとすると、私はこのエラーを取得し、2つの入れ子モデルとフォームを持っている:ここではRails 3.2.3:関連するモデルを一括して割り当てる方法は?
ActiveModel::MassAssignmentSecurity::Error in ExperimentsController#create
Can't mass-assign protected attributes: descriptions_attributes, circuits_attributes
は私のモデルである:
class Experiment < ActiveRecord::Base
attr_accessible :title, :intro_text
has_many :circuits, :dependent => :destroy
has_many :descriptions, :dependent => :destroy
accepts_nested_attributes_for :descriptions, :reject_if => lambda { |a| a[:data].blank? }, :allow_destroy => true
accepts_nested_attributes_for :circuits, :reject_if => lambda { |a| a[:data].blank? }, :allow_destroy => true
end
class Circuit < ActiveRecord::Base
attr_accessible :data, :title
belongs_to :experiment
end
class Description < ActiveRecord::Base
attr_accessible :data, :title
belongs_to :experiment
end
フィールドにattr_accessible
を追加できますが、ネストされたモデルはどうですか?追加
ありがとう、それは働いた – simo