Forum: Ruby on Rails Difference in find_by

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.
Gerard (Guest)
on 2006-01-08 00:04
(Received via mailing list)
Hi all,

Been digging to a lot of ruby docs to understand more of what Rails is
exactly
doing. Can somebody tel me what the difference in use is between the
"@params" and "params". (I know the first is a instance variable and the
second is a 'normal' variable. What does this mean in pratical terms?

@contact = Contact.find(@params['contact']['id'])

@user = User.find_by_firstname(params[:user][:firstname])


Regards,

Gerard.

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
Joshua S. (Guest)
on 2006-01-08 02:22
Gerard wrote:
> Been digging to a lot of ruby docs to understand more of what Rails is
> exactly
> doing. Can somebody tel me what the difference in use is between the
> "@params" and "params". (I know the first is a instance variable and the
> second is a 'normal' variable. What does this mean in pratical terms?

"@params" is an instance variable defined in ActionController::Base
"params" is an accessor method that returns the object in that variable.
you can also spell it "params()"

There are similar accessors for @session, @request, @response, etc.

j
This topic is locked and can not be replied to.