这是我的模特
class UnitPlate < ActiveRecord::Base
has_many :unit_plate_components, :dependent => :destroy
accepts_nested_attributes_for :unit_plate_components, :allow_destroy => true
has_many :components, :through => :unit_plate_components
end
这就是我写的allowed_params
的方式def unit_plate_params
params.require(:unit_plate).permit(:name,:name_type,:type,:unit_plate_components_attributes => [:id, '_destroy',:component_id,:name,:type,:parent_id,:lft,:rgt,:depth])
end
It is complaining about this on save which is not saving my record
Unpermitted parameters: component_id, _destroy
Unpermitted parameters: name_type
This is the raw parameters
Parameters: {"utf8"=>"✓", "authenticity_token"=>"CfGubZxXPW/7XEHEhnFTjKVKByNxGb5r3KJqoqoXHms=", "unit_plate"=>{"name"=>"okay", "name_type"=>"cool", "parent_id"=>"", "unit_plate_components_attributes"=>{"1375181809419"=>{"component_id"=>"181", "_destroy"=>"false"}}}, "commit"=>"Create Unit plate"}
关于出了什么问题的任何线索?
先谢谢。