title: How to handle two nested siblings, with to_json next?
body: <p>The to_json ActiveRecord docs say <a href="http://apidock.com/rails/ActiveRecord/Serialization/to_json" rel="nofollow">this</a> for dealing with two nested models, where comments is nested in posts:</p>
  
  <pre><code>  konata.to_json(:include =&gt; { :posts =&gt; {
                                   :include =&gt; { :comments =&gt; {
                                                 :only =&gt; :body } },
                                   :only =&gt; :title } })
    # =&gt; {"id": 1, "name": "Konata Izumi", "age": 16,
          "created_at": "2006/08/01", "awesome": true,
          "posts": [{"comments": [{"body": "1st post!"}, {"body": "Second!"}],
                     "title": "Welcome to the weblog"},
                    {"comments": [{"body": "Don't think too hard"}],
                     "title": "So I was thinking"}]}
  </code></pre>
  
  <p>Suppose I have two models that are nested, <strong>but not deeply nested</strong>. Lets say its a user model and comments model. The nested Models would be what I call nested siblings.</p>
  
  <p>I would like my json to look like this:</p>
  
  <pre><code>x = { 
      "Blog": {
          "Comments": [
           {"id":1,"name":"John Doe"},
           {"id":2,"name":"Don Joeh"}
          ],
          "User": [
           {"id":2,"company":"ACME"},
           {"id":4,"company":"BUD"}]
      }
  }
  </code></pre>
  
  <p>When I use the include method twice, what I end up is a series of deeply nested json, where users are children of comments. whats wrong?!</p>
  
  <pre><code>data.to_json(
          :include =&gt; { :blog =&gt; {
            :include =&gt; [{ :comments =&gt; {
              :except =&gt; SKIPPED_COLUMNS,
              :methods =&gt; [:_type]
            }},
            { :users =&gt; {
                :except =&gt; SKIPPED_COLUMNS,
                :methods =&gt; [:_type]
            }}],
            :except =&gt; SKIPPED_COLUMNS,
            :methods =&gt; [:_type]
          }},
          :except =&gt; SKIPPED_COLUMNS,
          :methods =&gt; [:_type]
        )
  </code></pre>