can access the through attributes from the many with has_many through?

hi -

if i have

A has_many B A has_many C through B

Is there any way to retrieve the B attributes once I have a C object?

For example:

class User < ...

has_many :friend_links has_many :friends, :through => :friend_links, :class => User ...

friends = user.friends for f in friends   link = f.friend_link #i want to get the through object because i store some metrics here

is this possible? i realize i can just ignore the through and just grab the friend_links directly, but i have various types of friends, some are borne of friend_links, others have a different genesis, and i'd like to just treat them in one fell swoop, and if one of them happens to be born of a through, i'll do one thing, but otherwise, i'll do something else.

thanks for any help, dino

hi -

if i have

A has_many B A has_many C through B

Is there any way to retrieve the B attributes once I have a C object?

Assuming that you also have B has_many C C belongs_to B

then if you have a C in @c you can say @c.b

Colin