I am getting the following error when submitting a rails 4 form:
ActionController::ParameterMissing - param is missing or the value is empty: player:
The form is correct. The problem is that it is a one field form, and I want the field to be optional, so that if a user doesn't enter information for the field, clicking submit just goes to the next part of the site. The issue is that I need to sanitize the params using strong parameters. Here is what I have so far:
def presentation_params
params.require(:player).permit(:name)
end
The problem is that it requires player, and player data is only submitted if the form field is not blank.
I've also tried replacing the word "require" with the word "fetch" but it returns the same error.
How do I allow the user to press submit, still move on, and yet not introduce a security issue by getting rid of strong params?