Facebooker: de-puzzle me, please! :)

[NB] probably I'm just too tired to see what I'm doing wrong..

I'm testing my first app and I'm playing with friends:

<%= @user.inspect %>

==>

#<Facebooker::User:0x3620388 @friends=[#<Facebooker::User:0x3620338
@id=11001717, @session=#<Facebooker::Session:0x3625ab8
@session_key="ad4bd8999ba887ccf1bc55d1-630930558",
@secret_from_session=nil, @auth_token=nil, @user=#<Facebooker::User:
0x3620388 ...>, @api_key="6aad53d26db4132a404f7ecd02300c49",
@expires=0, @uid=630930558,
@secret_key="51e9993873e8e7d36e7be9d6c5e29b66">>, #<Facebooker::User:
0x3620324 @id=22604621, @session=#<Facebooker::Session:0x3625ab8
@session_key="ad4bd8999ba887ccf1bc55d1-630930558",
@secret_from_session=nil, @auth_token=nil, @user=#<Facebooker::User:
0x3620388 ...>, [CUT]

If I loop my friends and inspect objects I have similar (but
restricted) items:

==>

#<Facebooker::User:0x360a6c8 @id=11001717,
@session=#<Facebooker::Session:0x360e458
@session_key="ad4bd8999ba887ccf1bc55d1-630930558",
@secret_from_session=nil, @auth_token=nil, @user=#<Facebooker::User:
0x360a718 @friends=[#<Facebooker::User:0x360a6c8 ...>,
#<Facebooker::User:0x360a6b4 @id=22604621,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a68c @id=500209860, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a664 @id=503592015,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a628 @id=508240872, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a5ec @id=509541043,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a5b0 @id=513849727, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a574 @id=516378422,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a524 @id=523292187, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a4e8 @id=526348207,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a4ac @id=527250651, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a45c @id=530571506,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a420 @id=542146446, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a330 @id=543519441,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a240 @id=546968421, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a204 @id=547882501,
@session=#<Facebooker::Session:0x360e458 ...>>, [CUT]

#<Facebooker::User:0x360a6b4 @id=22604621,
@session=#<Facebooker::Session:0x360e458
@session_key="ad4bd8999ba887ccf1bc55d1-630930558",
@secret_from_session=nil, @auth_token=nil, @user=#<Facebooker::User:
0x360a718 @friends=[#<Facebooker::User:0x360a6c8 @id=11001717,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a6b4 ...>, #<Facebooker::User:0x360a68c @id=500209860,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a664 @id=503592015, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a628 @id=508240872,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a5ec @id=509541043, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a5b0 @id=513849727,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a574 @id=516378422, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a524 @id=523292187,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a4e8 @id=526348207, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a4ac @id=527250651,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a45c @id=530571506, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a420 @id=542146446,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a330 @id=543519441, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a240 @id=546968421,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a204 @id=547882501, @session=#<Facebooker::Session:
0x360e458 ...>>, #<Facebooker::User:0x360a1c8 @id=556532498,
@session=#<Facebooker::Session:0x360e458 ...>>, #<Facebooker::User:
0x360a18c @id=559118926, @session=#<Facebooker::Session:
0x360e458 ...>>,[CUT]

even these objects are Facebooker::User objects, but I can't access
@friends array! I want those ids

What am I not seeing ?

thank you :slight_smile:

Of course, I printed two friends, but I want to access their
friends... (I was not so clear..)
I see the ids with when I inspect, but I can't reach them :x

dammit :slight_smile: :slight_smile:

Emanuele Mek Tozzato wrote:

Of course, I printed two friends, but I want to access their
friends... (I was not so clear..)
I see the ids with when I inspect, but I can't reach them :x

@user.friends will be an array of users. If you want to access their
friends (if you have access to them), then:

@user.friends.each do |person|
  # here person.friends will be an array of friends
  # of one friend of @user
end