Basically, as my Rails 4.2 applications become more complicated, I sometimes forget to include the appropriate parameters in the user_params strong parameters hash. This leads to information not being saved. For example, I might forget to include the :nickname as per below code.
what's a good way to test that I have included the whitelisted parameters? I don't care if they are nil or some other value, I just need a failing test to remind me to include the parameter.
def user_params
params.require(:user).permit(:id, name, user_nested_attributes: [:nickname, :pet])
end
Aucun commentaire:
Enregistrer un commentaire