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