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

Using 'synced' as field name prevents validates_inclusion_of from working as intended

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.0.0, 6.1.1
    • Affects Version/s: 6.1.0
    • Component/s: None
    • Environment:
      ruby 2.4.1, rails 5.0.1

      Tested via rails console:

      Loading development environment (Rails 5.0.1)
      2.4.1 :001 > t = TestModel.new
      => #<TestModel _id: 58eb0894f050165b32955e7c, synced: false, nsynced: false>
      2.4.1 :002 > t.save
      => false
      2.4.1 :003 > t.errors
      => #<ActiveModel::Errors:0x007ff3f1a6e928 @base=#<TestModel _id: 58eb0894f050165b32955e7c, synced: false, nsynced: false>, @messages={:synced=>["is not included in the list"]}, @details={:synced=>[{:error=>:inclusion, :value=>{}}]}>

        1. test_model.rb
          0.2 kB
          Benjamin Seow

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            benjamin.seow8 Benjamin Seow
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: