title: Iterating through IDs Ruby on Rails
body: <p>I have been advised not to store arrays in my DB, but instead just IDs.  In my project, I am storing IDs for line-items.  If I don't have a line_item OBJECT, but only IDs, could I still iterate through a loop to get all of the data associated with it?</p>
  
  <p>To explain further...</p>
  
  <p>Traditionally I feel like I have </p>
  
  <pre><code>@line_item
  &gt;&gt; &lt;LineItem id: 63, product_id: 2, created_at: time, (etc) &gt;
  </code></pre>
  
  <p>Then I could do something like</p>
  
  <pre><code>@line_item.title
  &gt;&gt; "T-Shirt:Small"
  </code></pre>
  
  <p>But what if I did </p>
  
  <pre><code>@line_item
  </code></pre>
  
  <p>and got</p>
  
  <pre><code>&gt;&gt;[12, 14]
  </code></pre>
  
  <p>Could I do a @line.item.each and get to all the information I need from the just the IDs in the view?? or would I have to create my own scary method?</p>
  
  <p>Hopefully I've posed my question understandably.</p>
  
  <p>Thanks.</p>