As you probably guess I'm pretty new to RoR. I'm going through
railstutorial.org, which I would recommend to other beginners like me, but
at some point in chapter 8 there's a bit of code I don't really get in the
Here's the code I'm talkng about :
cookies.permanent[:remember_token] = user.remember_token
self.current_user = user
@current_user = userend
@current_user ||= User.find_by_remember_token(cookies[:remember_token])end
What does self.current_user = user do?
It calls the current_user=(user) method passing user as a parameter,
right? But do we need the user parameter? I got rid of it and it works
fine, as far as I can see.
What does current_user=(user) do?
And what/who calls current_user when?
... I'm kind of confused. If someone could explain that a bit, I would
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 firstname.lastname@example.org.
To unsubscribe from this group, send email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ewyhx34_D4YJ.
For more options, visit https://groups.google.com/groups/opt_out.