Forum: Ruby on Rails form param?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jamal S. (Guest)
on 2007-02-16 01:55
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
Matthew M. (Guest)
on 2007-02-16 02:15
(Received via mailing list)
Jamal S. wrote:
>
> 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 M.
blog.mattmargolis.net
Jamal S. (Guest)
on 2007-02-16 02:29
Matthew M. wrote:
> Jamal S. wrote:
>>
>> 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 M.
> blog.mattmargolis.net

hehehe, thats really funny you can not imagine how many things i tried..

@parameters['user_username']
@params[:user[username]];
@params['user']['username']

and plenty of others, nothing work..but in the end yours worked :D and
thanks for your help...

and thanks for telling me about the old way :D I'm still new
This topic is locked and can not be replied to.