as_json not working with Rails render for embedded docs

XMLWordPrintableJSON

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

      Hoping that issue https://github.com/mongoid/mongoid/issues/1756 would fix my issue, but this is not the case.

      I can confirm that MONGOID-1757 does fix the as_json calls for embedded docs, but once they get passed to #render, embedded docs do not seem to produce their as_json in the output. The root doc will produce the as_json override, but the embedded docs do not when using rails #render on rails 3.1.4 (also tried latest 3.2.x branch).

      This was not the behavior on mongoid 2.3.x.

      for example:

      1. Produces the correct output for the embedded docs
        p out.as_json
      1. Once it's rendered, only the root respects the as_json override, the embedded docs are not respected.
        render json: out

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

                Created:
                Updated:
                Resolved: