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

Fixed case insensitive uniqueness validation for localized fields

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

      Localized fields should be validated separately for each localization because the value should be unique in each locale.

      For example, we have a document with localized attribute:

      { description:

      { "en" => "Car", "de" => "Auto" }

      }

      We want to add a new document:

      { description:

      { "en" => "Motorbike", "de" => "Auto" }

      }

      The description hash is different but we have the same value for "de" locale. To solve this issue I implemented uniqueness validation for licalized fields using $or selection:

      validatable.or(

      { "description.en" => "Motorbike" }

      ,

      { "description.de" => "Auto" }

      )

      case_sensitive flag was also fixed.

            Assignee:
            Unassigned Unassigned
            Reporter:
            voldy voldy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: