One of the first things to do is check if this feature would not proposed before. I think you will see that it was already proposed and rejected.
See https://github.com/rails/rails/pull/16997 On Wed, Mar 28, 2018 at 1:21 AM Regan Ryan <regan.ryan...@gmail.com> wrote: > Hi there, > > I've never contributed to Rails before, so if I'm doing something wrong, > please point me in the right direction. > > I often do something like `User.all.sample` in Rails console to get a > random record. This is ok, but it loads every record from the db before > calling `sample` to get a single record. Some projects have 100k+ users, so > that takes some time. > > *I would like to contribute to Rails by adding a > `ActiveRecord::Scoping::Named::ClassMethods#sample` method to retrieve a > single (or more if an argument is specified) random record from the db.* > > I've been reading a couple of "how to contribute to rails" guides, one of > them led me to this group. Is anyone able to guide me from here? How do I > get approval for this feature? > > Cheers, > Regan > > -- > 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. > -- 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.