Hey
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
end
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?
thx
···
--
Posted via http://www.ruby-forum.com/.
Hi, Isti, this is a forum for the Ruby programming language. It looks like
your question probably has more to do with how to use some specific library
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 your
specific topic.
If it's ActiveRecord, then a Rails group should be well suited to answering
your question. I see you're posting from ruby-forum.com, which has a link on
the left hand side to a Rails forum.
If it's some other library, check the documentation (go to rubygems.com,
search for the gem, follow to the homepage or the source code, there will
usually be a link to a google group or forum or message board of some sort,
if the lib merits one).
···
On Fri, Sep 16, 2011 at 10:53 AM, Isti Blasko <istiblasko@gmail.com> wrote:
Hey
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
end
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?
thx
--
Posted via http://www.ruby-forum.com/\.
Yes, it's Rails!
I'll go that topic then, thanks.
···
--
Posted via http://www.ruby-forum.com/.