I have a code like this:
User.create(params[:user])
But if someone sends params through API like
{"userr":{"name":"Firstname"}}
then I get 500 error because of undefined method * for nil:NilClass. How should I handle this and should I at all?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Of course you should handle false input – this is a situation which might happen in production as well.
I’d simply do: