Update the updated_at field when updating a HABTM association

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Persistence
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following mongoid model:

       

      class Location  
        include Mongoid::Document  
        include Mongoid::Timestamps
      
        has_and_belongs_to_many :tags, class_name: 'LocationTag', inverse_of: nil
      end

      If we do:

      location.update(tags: LocationTag.all.to_a)
      

      the updated_at field of the location doesn't get bumped.

      However, if we do:

      location.update(tag_ids: LocationTag.all.map(&:id))

      It does bump the updated_at.

            Assignee:
            Unassigned
            Reporter:
            Martin Mochetti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: