# How do you display all entries of a user's children?

**URL:** <https://www.ruby-forum.com/t/how-do-you-display-all-entries-of-a-users-children/121251>\
**Category:** Rails\
**Created:** [November 26, 2007, 3:32am UTC](https://www.ruby-forum.com/t/how-do-you-display-all-entries-of-a-users-children/121251 "2007-11-26T03:32:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [November 26, 2007, 3:32am UTC](https://www.ruby-forum.com/t/how-do-you-display-all-entries-of-a-users-children/121251/1 "2007-11-26T03:32:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [November 26, 2007, 4:05am UTC](https://www.ruby-forum.com/t/how-do-you-display-all-entries-of-a-users-children/121251/2 "2007-11-26T04:05:43Z")

</div>

Bob S. 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

🙂
