Lin Wj wrote: > Thanks > > totally got lost ploughing thru Userstamp's code > probably a good time for me to start learning some metaprogramming
Not that I spend much time digging though the code of Userstamper myself, but I believe this this the key to what makes the magic happen: --------------------------- The Userstamp module that we included into our ApplicationController uses the setter method to set which user is currently making the request. By default the 'set_stampers' method works perfectly with the RestfulAuthentication[http://svn.techno-weenie.net/projects/plugins/restful_authentication] plug-in: def set_stampers User.stamper = self.current_user end --------------------------- The current_user get passed into into the model layer from the controller layer. That is, as opposed to the model layer pulling the current_user directly from the session, which would break the MVC pattern. There are many ways to pass that information down into the model but, the point is that it's the controller layer's responsibility to push state information down into the model layer. -- Posted via http://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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.