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

Validations not run on non-changed data

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

      I'm not sure if this is intentional with Mongoid (it's not on http://mongoid.org/docs/validation.html if it is) or not but it's different behaviour from AR.

      Basicly: take two records (Artist) with a uniqueness constraint on :name field. Both persisted to db with the same name. Using AR:

      >> Artist.first.valid?
      false
      

      Mongoid:

      >> Artist.first.valid?
      true
      

      I discovered this with validates_uniqueness_of. Not sure if it happens with other types of validations.

      Mongoid 2.4.8 - ruby 1.9.3p125

            Assignee:
            Unassigned Unassigned
            Reporter:
            wulffeld Martin Moen Wulffeld
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: