ruby on rails - Query works in console and not works in application -


i have following code:

user = user.find_by(authentication_token: params[:authentication_token]) user.update(ip: nil) 

when try these lines on rails console works charm. when try on app, doesn't work @ all.

it releases following error:

undefined method `update' nil:nilclass

any help?

by searching , debugging, found '+' isn't appearing in authentication token in controller, it's replaced space, found solution here on stackoverflow says replace + sign '%2b' after generating random token.

and worked.


Comments