I have 2 Models, Kid and friend_list. To the the kid I use:
k = Kid.where(email: "[email protected]").first
Then, to get the friend list I type:
k.friend_list
and I get:
[#<FriendList _id: 5305cb6485216d2689004785, _type: nil, name: "Friends", members: ["5374a1f320db90054c0000ea", "537c63ea20db9040d2000332"], kid_id: BSON::ObjectId('5305cb6285216d2689004742'), teacher_id: nil>]
But I only need the "members".
I tried
k.friend_list.members, but I get
NoMethodError: undefined method `members' for
#<Array:0x007fcf4b013138> from /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p484@blabloo/gems/mongoid-2.8.1/lib/mongoid/criteria.rb:387:in
`method_missing'
How can I get only the members array??
Thanks in advance.
Kidhasbelongs_to: friend_list?