I''m building a test application where admin users have sub-users. Now, I want to let the admin user see all entries of their sub-users. For instance, I tried: "current_user.children.entries" (where current_user is the admin user), but I''m getting an undefined method. What''s the correct syntax to do it? -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bob Sanders
2007-Nov-26 03:05 UTC
Re: How do you display all entries of a user''s children?
Bob Sanders wrote:> I''m building a test application where admin users have sub-users. Now, I > want to let the admin user see all entries of their sub-users. > > For instance, I tried: "current_user.children.entries" (where > current_user is the admin user), but I''m getting an undefined method. > > What''s the correct syntax to do it?nevermind, I got it with: current_user.children.collect(&:entries).flatten :) -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---