Forum: Ruby on Rails params[] vs @params[]

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.
2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2006-03-31 18:10
(Received via mailing list)
Is there a difference in the way that params[] and @params[] are
handled?

Is the 'handling' done by Ruby or Rails?

A pointer to the relevant documentation would be sincerely appreciated.
Or just an answer would be ok too ;-)

Thanks,
Bill
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-03-31 18:56
(Received via mailing list)
params[] is preferred now because 'params' is a method call and
'@params' is an instance variable.  I had this question myself and
when AWDR had both styles, I asked a Rails core team member when I
saw him.

-Rob


Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2006-03-31 19:23
(Received via mailing list)
Thanks, Rob.  The 'preferred' part still throws me since it's apparently
still true that '@params[]' and 'params[]' will both work to access the
params hash.  Yes?

Also, when you say 'params' is a method call...  I would have thought
that it could also be a local variable whose interpretation at runtime
would be context sensitive.  No?

Confusing ;-(

Thanks again,
Bill
  ----- Original Message -----
  From: Rob Biedenharn
  To: rails@lists.rubyonrails.org
  Sent: 2006-03-31 10:53 AM
  Subject: Re: [Rails] params[] vs @params[]


  params[] is preferred now because 'params' is a method call and
'@params' is an instance variable.  I had this question myself and when
AWDR had both styles, I asked a Rails core team member when I saw him.


  -Rob




  Rob Biedenharn http://agileconsultingllc.com
  Rob@AgileConsultingLLC.com
  +1 513-295-4739




  On Mar 31, 2006, at 10:51 AM, Bill Walton wrote:


    Is there a difference in the way that params[] and @params[] are
handled?

    Is the 'handling' done by Ruby or Rails?

    A pointer to the relevant documentation would be sincerely
appreciated.  Or just an answer would be ok too ;-)

    Thanks,
    Bill
    _______________________________________________
    Rails mailing list
    Rails@lists.rubyonrails.org
    http://lists.rubyonrails.org/mailman/listinfo/rails




------------------------------------------------------------------------------


  _______________________________________________
  Rails mailing list
  Rails@lists.rubyonrails.org
  http://lists.rubyonrails.org/mailman/listinfo/rails
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-03-31 19:36
(Received via mailing list)
On 3/31/06, Bill Walton <bill.walton@charter.net> wrote:
>
> Thanks, Rob.  The 'preferred' part still throws me since it's apparently
> still true that '@params[]' and 'params[]' will both work to access the
> params hash.  Yes?

Think "deprecated."  Using @params will work, but it's not the
idiomatic way of doing it.

-- James
This topic is locked and can not be replied to.