2010/10/21 Bodaniel Jeanes <[email protected]>

> Ben,
>
> I assume you are doing has_many :boards, through => :memberships?
>
> Isn't this just @user.memberships? Or are users associated with boards in a
> different wy?
>

Yep, User -> Membership and Board -> Membership are both standard has_many
relationships.

So, current_user.memberships is all this user's memberships. I'm after all
the memberships on all the boards this user is a member of. That is, for
every membership that Membership.where(:user_id => current_user.id) returns,
I want to also include every other membership to the corresponding board.

(The purpose of this is a readable_by filter for Membership: it's all the
memberships that this user can know exist. That is, a given user can see all
the memberships on all the boards they're a member of.)

(If there's a better way to do what I'm trying to do then I'd be keen to
hear that too.)

—ben_h

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" 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/rails-oceania?hl=en.

Reply via email to