On Dec 21, 7:16 pm, John Merlino <[email protected]> wrote:

> One thing I forgot to mention is we assign the local variable u to the
> session :user:
>
>       if session[:user] = User.authenticate(params[:user][:login],
> params[:user][:password])
>
> Hence, the session has this user stored.
>
> THis is a little unclear to me though:
>  session[:user]
>
> We are storing a symbol called :user in sesion associative array. So
> :user is initiaized with vaue of u (whcih is dataset we returned).
> What's the purpose of using symbol here? Why can't we use something else
> like a variable?

Why would you want to? If you're going to store something in the
session you might as well use a constant as the key. You don't have
to, but you'd just be making life more complicated

Fred
>
> THanks for response.
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to