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

Accessing the field by square bracket operator + Custom field serialization

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

      When I access field with custom serialization by square bracket operator or read_attribute method, I get raw value. Is it a bug? Example:

      class Record
        include Mongoid::Document
        field :test, type: TreeValue
      end
      
        record.test # <TreeValue:0x007f9e47034c78>
        record[:test] # Array (2 elements)
        record.read_attribute(:test) # Array (2 elements)
      

      Mongoid v4.0.1

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

              Created:
              Updated:
              Resolved: