Joining an array with a table


I am pretty new to Ruby and I have no idea how to solve the following:

I have a join query on a table like this:

def mytags
Taggable.joins(“JOIN taggables as filter ON taggables.tag_id =
filter.tag_id WHERE filter.taggable_type = ‘User’ AND filter.taggable_id
= 1”).all

this works perfectly fine.
then I want to join the result on another table, where
OtherTable.joins(@mytags) works also fine BUT I want to
join on two other colums and NOT on the ids…

Can anyone tell me how to do this?

On Fri, Sep 16, 2011 at 10:53 AM, Isti B. [email protected]

Posted via

Hi, Isti, this is a forum for the Ruby programming language. It looks
your question probably has more to do with how to use some specific
written in Ruby (I’m guessing ActiveRecord), so it’s not likely that
many of
us can help you out. Probably there is a more focused mailing list for
specific topic.

If it’s ActiveRecord, then a Rails group should be well suited to
your question. I see you’re posting from, which has a
link on
the left hand side to a Rails forum.

If it’s some other library, check the documentation (go to,
search for the gem, follow to the homepage or the source code, there
usually be a link to a google group or forum or message board of some
if the lib merits one).

Yes, it’s Rails!
I’ll go that topic then, thanks.