So, I\'m getting the following error when trying to visit the films page on my app:
ActionController::ParameterMissing (param is missing or the value is empt
Why not use so:
def creation_params
params.permit(:film)
end
It working for me! ;)
I have got this problem too when I use Angular JS form to send data to backend Rails 4. When I did not fill anything in angular js form, the error will show ActionController::ParameterMissing (param is missing or the value is empty:
.
I fix it by adding params.fetch(:film, {})
the strong parameter into:
params.fetch(:film, {}).permit(:name, :sort_name, :description, :short_description, :meta_data,
:poster, :amazon_link, :active, :trackable, :country_ids => [])
I refer to code example to avoid ActionController::ParameterMissing (param is missing or the value is empty: film)
I hope this will help you.
This is happening because you have specified to require 'film' in your parameters through strong_params (specified above in your permitted_params code).
Whatever the view side is doing (whether its a link or a form/etc.), its not passing its parameters nested under 'film'
eg.) if you were to raise params.inspect
in the controller action, you would see that there is no node for "film".
Most likely what is wrong is that the form code you have on the view side is not set to nest these parameters properly, are you using a form_tag
for example?