Difference in find_by


#1

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!


#2

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