1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record/relation
Tekin Suleyman 3b9982a3b7
Make implicit order column configurable
When calling ordered finder methods such as +first+ or +last+ without an
explicit order clause, ActiveRecord sorts records by primary key. This
can result in unpredictable and surprising behaviour when the primary
key is not an auto-incrementing integer, for example when it's a UUID.
This change makes it possible to override the column used for implicit
ordering such that +first+ and +last+ will return more predictable
results. For Example:

  class Project < ActiveRecord::Base
    self.implicit_order_column = "created_at"
  end
2018-11-26 16:19:52 -08:00
..
batches Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
predicate_builder Lazy checking whether or not values in IN clause are boundable 2018-10-24 11:26:49 +09:00
batches.rb Extract Relation#bind_attribute for internal use 2018-07-30 00:57:44 +09:00
calculations.rb Permit list usage cleanup and clearer documentation 2018-08-27 09:51:46 -04:00
delegation.rb Generate delegation methods to named scope in the definition time 2018-10-09 13:03:08 +09:00
finder_methods.rb Make implicit order column configurable 2018-11-26 16:19:52 -08:00
from_clause.rb Refactor Active Record to let Arel manage bind params 2017-07-24 09:07:24 -04:00
merger.rb Bugfix ActiveRecord::Relation#merge special case of from clause 2018-09-28 11:46:40 +03:00
predicate_builder.rb Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
query_attribute.rb PostgreSQL: Treat infinite values in date like datetime consistently 2018-02-23 11:15:00 +09:00
query_methods.rb Don't expose internal get_value/set_value methods 2018-10-18 08:29:58 +09:00
record_fetch_warning.rb Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
spawn_methods.rb Revert "Short circuit the scoping delegation for relation.all" 2018-07-19 07:54:31 +09:00
where_clause.rb Arel: Implemented DB-aware NULL-safe comparison (#34451) 2018-11-15 14:49:55 -05:00
where_clause_factory.rb Use private attr_reader 2018-02-23 11:10:51 +09:00