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

Length validations on localized fields still fail

      Although it was reported to be solved in MONGOID-1939, I still can't get localized length validations to work. I have set my gem file to use the 2.4.0-stable branch, and it's now using commit deeadf06a6aa5b9a6decf8781899b1faed5751e8. I have also setup i18n fallbacks and the default locale in environment.rb.

      ...
        field :title,       type: String,  localize: true, default: ""
        field :description, type: String,  localize: true, default: ""
        field :content,     type: String,  localize: true, default: ""
        field :published,   type: Boolean, default: false
        field :featureable, type: Boolean, default: false
      
        validates_presence_of :title
        validates_presence_of :description
        validates_presence_of :content
        validates_format_of :title, with: /^[a-z0-9 \-_]*$/i
        validates_length_of :title, minimum: 32, maximum: 100
        validates_length_of :description, minimum: 140, maximum: 420
        validates_length_of :content, minimum: 420, maximum: 2.megabytes
      ...
      

      Is there an additional step I am missing? I should also mention that everything works as expected if I set localize to false.

            Assignee:
            Unassigned Unassigned
            Reporter:
            KazW KazW [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: