NoMethodError in UserController#login

this is the bit of code i'm having a problem with.. the odd thing.. if
i remove all the code in the def login, reload the page so the view
actually shows up put the code back in the def login and submit the
form.. it works just fine... but if i start with the code for the
login in the controller then it's broken and starts giving me the errors
posted below.

Assuming that you have a single login action that both displays the
form and submits it then the problem is that if there are no
parameters then params[:user] will be nil and so params[:user][:login]
is nonsensical. When you submit the form however the parameters will
be there and so there's no problem.
One way to deal with this would be to surround the relevant parts with
if ...


Frederick Cheung wrote: