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

Support Dirty Tracking changed from /to

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 8.1.0
    • Affects Version/s: None
    • Component/s: Attributes
    • Labels:
      None
    • Fully Compatible

      ActiveModel::Dirty has a nice way to check if attribute was changed from a particular value to a different particular value

      person.name_changed?(from: "Uncle Bob", to: "Bob") # => true
      

      It would be nice to support this syntax on Mongoid as well, changes should be fairly small. ActiveRecord uses a constant OPTION_NOT_GIVEN to flag when the parameters are available or not, see https://github.com/rails/rails/blob/80b9e5d7bde7b8b4c4479e20c927e9cf8fa158ac/activemodel/lib/active_model/dirty.rb#L180

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            CyrilDD Cyril
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: