Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4547

Implement #take / #take! for AR feature parity

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.1, 7.5.0
    • Affects Version/s: 7.0.0, 7.0.1
    • Component/s: Query
    • Labels:
    • Fully Compatible

      In https://jira.mongodb.org/browse/MONGOID-4470 users have asked that we add a shorthand for getting an arbitrary instance of a model from the database. Per https://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-take, the method should be called #take/#take!.

      Additional methods defined by AR (#second, #third, #fourth, #second_to_last) may also be implemented.

      When this is done, id_sort arguments to #first and #last should be deprecated.

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: