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

update_attribute on non-changed attr triggers observer after_save

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.4
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I've got some code like this that runs on a schedule.

      `ping -c 1 -W 1 #{stack.ip}`
      stack.update_attribute :online, $?.success?
      

      If the value of the online attribute hasn't changed, nothing is saved to the database. This is the documented behavior and what I would expect. However, the after_save callback is still triggered in my observer even though no save operation technically occurred. Is this the correct behavior?

            Assignee:
            Unassigned Unassigned
            Reporter:
            jbrown Julian Brown
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: