On Jul 31, 6:17 pm, 7stud -- <[email protected]> wrote: > Frederick Cheung wrote in post #1014004: > > > On Jul 31, 5:12pm, 7stud -- <[email protected]> wrote: > >> > the @current_user variable instead of calling the current_user= setter > >> > function. > > > Memoization is an extremely common practice. I find the existence of > > current_user= a little odd. > > Why's that? In the SessionsController there is a method that is defined > like this: >
because you've got some weird halfway house where sometimes current_user can work out what the current user is but in other cases it's assigned. Sometimes @current_user is just a cache, sometimes it's a most traditional ivar. Fred > def signin(user) > cookies.permanent.signed[:remember_token] = [user.id, user.salt] > self.current_user = user > end > > By the way, the book we are discussing is online and we are discussing > section 9.3: > > http://ruby.railstutorial.org/chapters/sign-in-sign-out#sec:signin_su... > > -- > 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.

