Forum: Ruby on Rails @session[] or session[]

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.
Justin B. (Guest)
on 2006-03-02 22:02
(Received via mailing list)
Which is more appropriate? @session[] or session[]? Both seem to work.
Is there a difference between which should be used in the controller
vs. the view?
Marcel Molina Jr. (Guest)
on 2006-03-02 22:09
(Received via mailing list)
On Thu, Mar 02, 2006 at 03:01:49PM -0500, Justin B. wrote:
> Which is more appropriate? @session[] or session[]? Both seem to work.
> Is there a difference between which should be used in the controller
> vs. the view?

session should be used exclusively. Same goes for params, controller,
etc.

marcel
Justin B. (Guest)
on 2006-03-02 22:40
(Received via mailing list)
On 3/2/06, Marcel Molina Jr. <removed_email_address@domain.invalid> wrote:
> session should be used exclusively. Same goes for params, controller, etc.

Thanks!

But any explanation as to why @session works?
Marcel Molina Jr. (Guest)
on 2006-03-02 22:40
(Received via mailing list)
On Thu, Mar 02, 2006 at 03:35:15PM -0500, Justin B. wrote:
> On 3/2/06, Marcel Molina Jr. <removed_email_address@domain.invalid> wrote:
> > session should be used exclusively. Same goes for params, controller, etc.
>
> Thanks!
>
> But any explanation as to why @session works?

Currently we have methods that just wrap instance variables. But, in the
future, there is no telling whether the underlying implementation will
change. By always using the method, we can easily change the
implementation
without changing the API.

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