Re: form param?

Matthew Margolis
Fri, 16 Feb 2007 00:15:21 -0000

Jamal Soueidan wrote:
> hello
>
> I have problems receiving the parameter from form?
>
> <input id="user_username" name="user[username]"
size="40" type="text" />
>
> in my controller
>
> @method = @params[''user_username''] or @method >
@params[''user[username]'']
>
> both is not working? not receiving anything??
>
> hope someone out their can giv a hand, and thanks :)
>
> //Jamal
>
>
Use params[:field] instead of @params[:field]  @params is the old way of
doing things.

Try
@method = params[:user][:username]

The data in the form will go into params[:user] and then you can access
the individual fields if you need to though most of the time you will
just be doing something like
@user = User.new(params[:user])

Matt Margolis
blog.mattmargolis.net