Hiya,

I’m working on a project that uses PostgreSQL UUIDs as primary keys. I’d like 
to make the first and last finder methods behave more predictably without 
having to resort to explicit order calls everywhere or setting default scopes. 
Having looked through the code for the finder methods, one option that has 
presented itself is to make the default sort order 
<https://github.com/rails/rails/blob/25760a492118886f5ecf570458217be8ea978678/activerecord/lib/active_record/relation/finder_methods.rb#L553>
 configurable so a column other than primary_key can be specified. I’m up for 
working on a patch for this but thought I’d post here for thoughts before I got 
stuck in. I’m imagining something like this to specify it:


  class Model < ApplicationRecord
    default_order_column :created_at
  end


Any thoughts?

Thanks in advance,

Tekin


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to