field :vid, :type=>Integer allows String to be saved and is valid

XMLWordPrintableJSON

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

        class VProduct
        include Mongoid::Document
        include Mongoid::Timestamps
        include Tire::Model::Search
        include Tire::Model::Callbacks
      
        field :vid, :type=>Integer   
        field :name                   # name -        Bezeichnung
      
        index :vid, unique: true
      

      when I set vid to a String, the doc is valid and i can save it. (and the string gets saved instead of an integer)

      shouldnt vid only accept Integers in this case?

      In my case i use the gem tire for elasticsearch. and it won't index documents which don't have an integer set for vid.

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

              Created:
              Updated:
              Resolved: