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

Serialization with :only and :include

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

      It seems that passing :only options to serializable_hash affects the serialization of :includes.

      <pre>
      person.serializable_hash(:include => :addresses)['addresses']
      > "addresses"=>[

      {"_id"=>"kudamm", "street"=>"Kudamm"}

      ,

      {"_id"=>"tauentzienstr", "street"=>"Tauentzienstr"}

      ]

      person.serializable_hash(:include => :addresses, :only => [:age, :blood_alcohol_content])['addresses']
      >"addresses"=>[{}, {}]
      </pre>

      I've committed some failing specs:
      https://github.com/njorden/mongoid/commit/0ceea8a4c4b3ace9d4892327ef228fe01df99154

      I'm glad to investigate a solution, as long as I'm not missing something obvious or misunderstanding how this should be working. Any thoughts?

      Thanks

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

              Created:
              Updated:
              Resolved: