ActiveRecord::Relation these days?
In prior versions of Rails, this would work:
assume (pseudo code):
model A
has_many b's
model B
,,,
at = B.arel_table
atalias = at.alias(at.name + "_1")
A.join(:b).join(atalias).where(atalias[:a_id].eq(at[:a_id]).where("b.widget
= 'foo'").where("b_1.widget = 'bar'"). ...
^ probably should be "on"
now in 3.1.1: passing in a arel_table into join ... returns a String,
not a relation, breaking the ActiveRecord::Relation chain.
In short: if we want to find A's where they contain *both* a B.widget
'foo' and a B.widget 'bar' ...
how do we do this without writing custom SQL ?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.