Avoid Rails Default Scopes
ยท One min read
A common mistake when beginning to use Rails is sprinkling all the models with default scopes specifying order.
class Foo < ActiveRecord::Base
default_scope { order(name: :asc) }
end
This will add order by's to query even when the order does not matter.