Mark, I tried your example but got the following .. undefined local variable or method `current_user'
On Oct 20, 11:50 am, Mark Sobkowicz <[email protected]> wrote: > In Chad Fowler's new book, Rails Recipes (not the old one of the same name), > Recipe 4 is about setting default scopes for models. I think it would do > what you are trying to do really easily. In your models you say > > belongs_to :user > default_scope where(:user => current_user) > > and you don't have to mess with your controllers at all. > > Mark > > On Oct 20, 2011, at 11:33 AM, Jeremy Savoy wrote: > > > > > > > > > 3. Define the controller actions to show only the current user's > > records, for example if you had a Tasks controller/model ... > > > auto_actions :all > > > def index > > hobo_index current_user.tasks > > end -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
