This works:


Model1.includes(:model2 => :model2).where(model2s: {order:  2})


How would I write a query for order <= 2?


What I would really like to write is:


Model1.includes(:model2 => :model2).where(“model2s.order <= 2”)


This worked in Rails 3, I would like to build up the where clause as a 
string.  Any ideas on how I can use a string to query an association in 
Rails 4 would be much appreciated.


Many thanks,


Mike

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a5315168-06f8-4425-b2e8-affef8759024%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to