Details. I have this in User:

scope :with_roles, lambda{|roles| joins(:roles).where(roles: {name:
roles})}

I was doing this:

@cashiers =
User.with_roles('cashier').includes(:order_transactions, :accounts).order
'order_transactions.creation_date'

Taking out the with_roles call:

@cashiers = User.includes(:order_transactions, :accounts).order
'order_transactions.creation_date'

Fixed the problem. SQL ran in almost the same amount of time, but
ActiveRecord stopped spinning its wheels for a couple of minutes
afterward.

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to