title: Rails: Adding values to Activerecord result
body: <p>Sorry if I used the wrong terminology, I'm still new to rails.</p>
  
  <p><strong>Problem:</strong> I retrieve an activerecord relation in a variable and I want to add more key/value pairs into each item in the array so they can all be easily accessed in the view. How do I do this? </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>def index
      @rooms = Room.all.reverse
      @sessions = Session.all
      ##returns =&gt; [#&lt;Session id: 4,  user_ip: "127.0.0.1", user_token: "", room_session: "", position: 2 ...&gt;], #&lt;Session id: 3, ...&gt;]
      @sessions.map  do |k, v|
        ##Add the room associated with each session &amp; other k/v pairs
      end
      ##want to return =&gt; [#&lt;Session id: 4, room: 'Marvin', spaghetti: 'monster' (etc...),  user_ip: "127.0.0.1", user_token: "", room_session: "", position: 2 ...&gt;], #&lt;Session id: 3, ...&gt;]
  
      end
    end
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>- @sessions.each do |session|
    %tr
      %td= session.topic_id
      %td= session.room
      %td= session.spaghetti
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I would like to able to add arbitrary values like 'spaghetti' => 'monster'
  and info from relations such as, Session.room</p>
  
  <p>What is the best way to do this?</p>
  
  <p>Thank you!</p>