I have a form that looks like this:
<%= start_form_tag :action => ‘login’ %>
|Username:||<%= text_field 'user', 'username' %>|
|Password:||<%= password_field 'user', 'password' %>|
<%= submit_tag ‘Login’ %>
<%= end_form_tag %>
And in the controller, this:
# If the deleted flag is set in the session, remove it
# now and give the user a new session.
# (when a user logs out, their session is removed too)
reset_session if session[:deleted]
@user = User.new
logger.info(“params user is:”)
@user = User.new(params[:user])
@authenticated_user = @user.try_to_authenticate
This code was written a long time ago and now I am trying to run it on
the production server. On my development server, everything is fine.
However on the production server (with environment set to ‘development’
for this debugging) it seems that params[:user] is never set.
On the development server I can see usernamepassword
in the log. On the production server, nothing is output. This
obviously causes problems because a user object with no
username/password is not going to authenticate (“can’t convert nil into
String” when trying to hash the users password using Digest::SHA1).
At first I thought it might be the versions of ruby/rails etc, but both
now report this:
About your application’s environment
Ruby version 1.8.5 (i686-linux)
RubyGems version 0.9.0
Rails version 1.2.1
Active Record version 1.15.1
Action Pack version 1.13.1
Action Web Service version 1.2.1
Action Mailer version 1.3.1
Active Support version 1.4.0
What would cause one machine to have a nil params[:user]? The two
machines have exactly the same code.