0
class Depot < ActiveRecord::Base
attr_accessible :code, :designation
has_many :articles
end
class Famille < ActiveRecord::Base
attr_accessible :code, :designation
has_many :articles
end
class Article < ActiveRecord::Base
belongs_to :depot
belongs_to :famille
attr_accessible :code, :designation
end
이 오류는 저장소 및 famille 필드가있는 새 기사를 만들려고 할 때 어떻게 해결합니까?activerecord association
ActiveModel::MassAssignmentSecurity::Error in ArticlesController#create
Can't mass-assign protected attributes: depot, famille
을 내가 그것을 attr_accessible해야한다고 생각 : 코드 : 지정 : depot_id : famille_id 여전히 같은 문제! – user2253258
오타를 유감스럽게 생각합니다. 그게 효과가 없다고 확신합니까? 컨트롤러 작업을 게시 할 수 있습니까? – Zippie
컨트롤러 https://gist.github.com/anonymous/5327873 – user2253258