I get an error Unpermitted parameters: latitude, longitude, address
in the log when I try to accept nested attributes from a form. The exact parameters look like this:
{
"widget"=> {
"owner"=>"100",
"name"=>"Widget Co",
"locations_attributes" => {
"0"=> {
"latitude"=>"51.4794259",
"longitude"=>"-0.1026201",
"address"=>"123 Fake Street"
}
}
},
"commit"=>"Create Supplier",
"action"=>"create",
"controller"=>"widgets"
}
has_many
Location widget and widget location belongs_to
. The parameters are set in widgets_controller
, which, as I thought, will allow everything under "0", but it doesn't seem to?
def widget_params
params.require(:widget).permit(:owner, :name, locations_attributes: [{"0" => []}])
end
Is there a working / best way to accept these options?
thank
Bebbs source
share