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

Accessing the field by square bracket operator + Custom field serialization

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: