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

Change serialize_relations to call #as_json on the relation

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

      Changed serialize_relations to call #as_json on the relation, so we respect the individual json representation of the relation model.

      Otherwise, this won't be satisfied for children with custom as_json:
      mother.as_json(:include => ['children'])['children'].first !== child.as_json

      This bug has existed in Rails too, see this ticket https://github.com/rails/rails/issues/576

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

              Created:
              Updated:
              Resolved: