I want to create several objects at a time, from my index view, so I have inputs: post[][title]
and post[][parent_id]
, in my post_controller.rb
i have:
def post_params
params.require(:post).permit(:title => [], :parent_id => [])
end
But I'm getting the error on submit: undefined method 'permit' for [{"title"=>"Title", "parent_id"=>"133"}]:Array
I read this post, but if I try params.permit(:title => [], :parent_id => [])
, then post_params
just returns empty hash.
params:
{"utf8"=>"✓",
"authenticity_token"=>"oJwfzxbn+LJ/pD1hKo27gckZg6P4Gd8wyNY9NSFS4BA=",
"post"=>{"title"=>["1",
"2"],
"parent_id"=>["",
""]},
"locale"=>"ru"}