Why current_user in controller?
Justin Ng
1 post
|
Great book, but I had a question about the current_user stuff in Chapter 4. My first thought is that the current user should be accessed via User.current instead of current_user in the application controller. Is there something about how Facebooker works that this refactoring will not help us? |
Mike Mangino
17 posts
|
Nope, there’s nothing that would keep this from working. I don’t normally include the concept of a current user in my models because my domain model rarely involves a current user, that is more likely to be an artifact of the interface. In this book, I decided to model the pattern of the restful_authentication plugin. Restful_authentication is probably the most popular Rails authentication plugin, so I figured it would be a well known interface to use. |
2 posts, 2 voices
