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

Touch with no Attribute Updates All Fields on Model

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.0
    • Component/s: None
    • Labels:

      Description

      Currently when calling touch without passing a field, all attributes on the model persist.

      This seems to happen on all versions of Mongo.

      Example:
      person = Person.new(name: 'Fred', updated_at: Time.now)
      person.name = 'Bob'
      person.touch
      person.reload
      person.name

      Related To Old Fix Attempt (2012):
      https://github.com/mongodb/mongoid/commit/796d4e1717f4383de3b4d3eedf1b922863d7b80e

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            cfritz Conner Fritz
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: