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?
[image: Bodaniel Jeanes]

*Bodaniel Jeanes* [image: LinkedIn]
<http://www.linkedin.com/in/bjeanes>[image:
Twitter]  <http://twitter.com/bjeanes>[image: Tungle.me]
<http://tungle.me/bjeanes>[image:
Blog] <http://bjeanes.com>
Whttp://bjeanes.com [email protected]+61412639224
[image: Google Talk] [image: MSN] [image: Google Wave] [email protected] [image:
Skype][image: AIM] bojeanes




On Thu, Oct 21, 2010 at 2:10 AM, Ben Hoskings <[email protected]> wrote:

> Hi all,
>
> I'm struggling to find any arel docs that cover anything but the most basic
> of joins.
>
> I have users and boards, with a memberships join table (memberships has
> user_id and board_id FKs). So,
>
>     User <--->> Membership <<---> Board
>
> For a given user, I want to select all memberships on boards to which this
> user has a membership. So, a slow 2-query version of what I want is
>
>     Membership.where(:board_id => current_user.boards.map(&:id))
>
> Can someone drop some arel knowledge on me?
>
> 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]<rails-oceania%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>

-- 
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