auto actions for is more for creation/updating from within the owning
model.  since the creation/updating is all controlled via lifecycles
for friendships, what you're looking for instead is a children
relationship.

however, with the way that friendships can be initiated in either
direction means that you can't grab the full list from a single
association (you need both friends through invitors AND invitees in
other words).  Either you can do two sql calls and then merge the
list, or do a find_by_sql call to grab both possibilities with one
call.  Maybe there's a way to make it with associations, not sure.

On Jan 25, 7:41 am, sol <[email protected]> wrote:
> Hey guys,
>
> Long time no hobo, but now I'm starting again ... and lost the
> overview of both rails and hobo :)
> Just a quick question, I'm not sure if it works, hopefully someone can
> help me:
>
> Considering the friendship model that is also mentioned in the
> lifecycle docs:
>
> user.rb
> has_many :friendships
> has_many :friends, :through => :friendships
>
> friendship.rb
> belongs_to :invitor, :class_name => 'User'
> belongs_to :invitee, :class_name => 'User'
>
> What I want to achieve now is a resource "user/3/friends" that lists
> all the friends of this user.
>
> I've tried with auto_actions_for in the users and friendship
> controller, but I'm not sure if it works - at least I cannot get it
> working.
> Is there a way to automagically do this? Or what would you suggest?
>
> Thanks in advance,
> sol

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to