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

Uniqueness validation with options of localize field does not work

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

      I use Mongoid 3.0.13.
      My model is as below

      class Foo
        include Mongoid::Document
        field :name, type: String, localize: true
        field :category
        
        validates :name, uniqueness: { scope: :category, case_sensitive: false }
      end
      

      But the uniqueness validation is ignored.

      Either without localize or modify the validation to

       validates :name, uniqueness: true 

      , the validation will work. But I need the validation work with scope and localize.

      Any suggestion? Thanks.

            Assignee:
            durran Durran Jordan
            Reporter:
            Ray-Wang Ray-Wang [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: