class method
self.shuffle_unordered_selects
Ruby on Rails edge
Since edgeShuffles the rows of every SELECT Active Record generates that has no +ORDER BY+ clause.
The order of such a query is not specified, and databases are free to return its rows in any order. Enabling this option makes that explicit, so code (and tests) that accidentally rely on the order a given database happens to return today fails loudly instead of breaking later.
It is meant to be enabled in the test or development environments only.
Rows are shuffled after the database has returned them, so queries built from raw SQL strings are left untouched (Active Record cannot tell whether they are ordered), and queries ending in +LIMIT 1+ are unaffected because the database has already picked the row.
Source
# File activerecord/lib/active_record.rb, line 415
singleton_class.attr_accessor :shuffle_unordered_selects
Defined in activerecord/lib/active_record.rb line 415
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord