How do I access this parameter?

Hi,

I have a form for creating users ...

<% form_tag 'userconfirm' do -%> <!-- more code --> <p><label for="user_login">Username</label><br/> <%= text_field 'user', 'login' %></p>

<p><label for="user_password">Password</label><br/> <%= password_field 'user', 'password' %></p>

<p><label for="password_confirmation">Confirm Password</label><br/> <%= password_field 'user', 'password_confirmation' %></p> <% end -%>

My question is, on the controller end, how do I access the parameter for login and password? I thought it would be params[:login] and params[:password], but that is not right. Any help is appreciated, - Dave

My code now:

        def userconfirm                 @user = User.new(params[:user])                 if @user.save                         # Create session                         if (log_user_in(params[:login], params[:password], nil))                                 redirect_to :controller => 'order', :action => 'new'                         else                                 flash[:notice] = "You are not logged in."                                 redirect_to :action => "start"                         end                 else                         render :action => 'userinfo'                 end         end

Hi,

I have a form for creating users ...

<% form_tag 'userconfirm' do -%> <!-- more code --> <p><label for="user_login">Username</label><br/> <%= text_field 'user', 'login' %></p>

<p><label for="user_password">Password</label><br/> <%= password_field 'user', 'password' %></p>

<p><label for="password_confirmation">Confirm Password</label><br/> <%= password_field 'user', 'password_confirmation' %></p> <% end -%>

Just take a look in your log files and you'll see that they arrive as
params[:user][:login], params[:user][:password]

Fred

Add the following if you are unsure in the controller method of interest:

puts params.inspect

it will dump the values to the console as another option to check...

Thanks for your help. It was indeed params[:user][:login]. I didn't know I could use the log file so I'm grateful also for that info, - Dave

If you are using rails 2, you can also use the debugger which is a TON of help. start script/server with --debugger and put “debugger” on the line you want it to stop on. Then you can inspect variables, step, and even evaluate routines. WAY cool!!

–Alan