Passing variables from view to controller(s)

One more from a noob :slight_smile:

Hi everyone,

I’m trying to pass two variables from the view (user entered data).
Compare one field with a database entry, if same the second field should
be saved in the database. :This is to let the user update his password:
I know it can be done but the have no idea how to :frowning: . Any help will be
greatly appreciated.

Thanks in advance

Hu Sushruth,

You shouldn’t need to pass variables from the view exactly, the
information is posted back to the controller and ends up in the @params
hash. However, I suggest you take a look at the code for the Login
generator. Try running this generator on a blank rails site, and you’ll
be able to go over the code. It’s very simple (compared to the more
robust salted hash version, or the login engine), and does exactly what
you’re suggesting.

Craig

craig wrote:

Hu Sushruth,

You shouldn’t need to pass variables from the view exactly, the
information is posted back to the controller and ends up in the @params
hash. However, I suggest you take a look at the code for the Login
generator. Try running this generator on a blank rails site, and you’ll
be able to go over the code. It’s very simple (compared to the more
robust salted hash version, or the login engine), and does exactly what
you’re suggesting.

Craig

Hey thanks Craig, I will try to use the login generator for now. I
really wanted to develop the whole thing on my own (I know its like
reinventing the wheel, so that i get a better understanding of the whole
thing. Thanks again.

Look at the code one of the generators produces, get a grip on what
it’s doing, and then see if you can re-write it in your own app. Use
it as a reference. Once you’ve done that, you’ll have a much better
footing for using the techniques you’ve seen to build your own
customised system. You’ll see whaht works for you, and which bits you
think are crap - and hopefully have better ideas to replace them!

  • james