Studying the RoR 3 Tutorial book by Michael Hartl
and on page 345 there's the code inside the SessionsHelper:

_________________________________________________________
module SessionsHelper

def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.sault]
self.current_user = user
end

end
__________________________________________________________

What is the purpose of "self" inside the session helper?
I know that inside a model it refers to the class object.
For example

Class User < ActiveRecord::Base
self.salt

it refers to User.salt

But when it is inside a helper, does it refer to the helper itself?
sessions.current_user = user ?
What's the meaning of it? To make it accessible to the controller &
view of Sessions ?

And also:

module SessionsHelper

def current_user= (user)
@current_user = user
end

The purpose of this line is to create an assignment to current user
and the existence of the instance variable @current_user is to
"permanently" stored, as long as it is needed  (not as a local
variable) since there's no model?

Im a little bit confused

-- 
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