title: Add new object in Relation and render JSON together
body: <p>I have a SQL search and it returns a Relation From Active Record.
  I need to iterate in this return and add a new object from its Relationship with other table and finally render json of it all together.</p>
  <p>Example: I have this return</p>
  <pre><code>example = #&lt;ActiveRecord::Relation [#&lt;Documento::Andamento id: 00001, nr_documento: 20211&gt;, #&lt;Documento::Andamento id: 00002, nr_documento: 20212&gt;, #&lt;Documento::Andamento id: 00003, nr_documento: 20213&gt;, #&lt;Documento::Andamento id: 00004, nr_documento: 21214&gt;]&gt;
  
  lista = Array.new
    example.each do |andamento|
      movimento = andamento
      movimento.objeto_tramitacao_interesse = andamento.objeto_tramitacao.objeto_tramitacao_interesse //relatioship
      lista &lt;&lt; movimento
      end
  
    render json: {autos_andamentos:[lista]}
  </code></pre>
  <p>I've tried something like this but went wrong</p>
  <p>I want to iterare and add a new object from a relationship table and render json of it all together</p>