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

Mongoid: support for 'saved_change_to_attribute', 'attribute_before_last_save' and 'will_save_change_to_attribute'

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 8.1.0
    • Affects Version/s: None
    • Component/s: Attributes
    • Labels:
      None

      Since Rails 5.1 there are additional methods to use in callback to track attribute changes, including 'saved_change_to_attribute' and 'attribute_before_last_save'. See this PR for details.

      Since Mongoid strives to maintain compatibility with ActiveRecord whenever possible, these method should be implemented.

      Original description
      attribute_changed? and attribute_was ActiveRecord methods will be deprecated inside of after_(create|update|save) callbacks source

      Does Mongoid support mettods saved_change_to_attribute? and attribute_before_last_save to maintain consistency ?

      Additionally support will_save_change_to_attribute.

            Assignee:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Reporter:
            rjurado_nss rjurado_nss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: