Params 101

This is incredibly basic, but…

I have a form that has fields defined for password and
password_confirmation. it is passing in the following data

Parameters: {“commit”=>“Change Password”,
“admin”=>{“password_confirmation”=>“beagle”, “password”=>“beagle”},
“id”=>“3”

I thought that processing the form data was a simple matter of
referencing params[:password] - but that is a nil value. It appears to
me that the password post data is within a hash within the hash. The
data is there, but the reference form is unclear.

What is the correct reference to the post data? e.g. how do I reference
the :password field?

Please forgive the very basic question.
—Michael

well you can access that information from params[:admin][:password]

the admin hash is because you probably put in your form like this <%
= password_field “admin”, “password” %> or in a form_for construct…

if you wanted to access just params[:password] you can do something
like…

<%= password_field_tag “password”, nil %>

jason.

jason cale wrote:

well you can access that information from params[:admin][:password]

the admin hash is because you probably put in your form like this <%
= password_field “admin”, “password” %> or in a form_for construct…

Jason,

Thanks.

The params field is a tad more involved (in a very good way) than it
appears on the surface. The data is there, but the referencing needs to
be done in the right way.

I never cease to be amazed at the willingness of the people here to help
people come up on rails. I do appreciate the help and promise to do my
homework.

—Michael

you’re very welcome :slight_smile: