title: Loop through ActiveRecord::Associations::CollectionProxy with each
body: <p>I have the following models set up with active record 4 (mapping a legacy database)</p>
  
  <pre><code>class Page &lt; ActiveRecord::Base
      self.table_name = "page"
      self.primary_key = "page_id"
      has_many :content, foreign_key: 'content_page_id', class_name: 'PageContent'
  end
  
  class PageContent &lt; ActiveRecord::Base
      self.table_name = "page_content"
      self.primary_key = "content_id"
      belongs_to :pages, foreign_key: 'page_id', class_name: 'Page'
  end
  </code></pre>
  
  <p>The following works fine....</p>
  
  <pre><code>page = Page.first
  page.content.first.content_id
  =&gt; 17
  page.content.second.content_id
  =&gt; 18
  </code></pre>
  
  <p>however i want to be able to loop though all the items like so</p>
  
  <pre><code>page.content.each do |item|
      item.content_id
  end
  </code></pre>
  
  <p>but it simply returns the whole collection not the individual field</p>
  
  <pre><code>=&gt; [#&lt;PageContent content_id: 17, content_text: 'hello', content_order: 1&gt;, #&lt;PageContent content_id: 18, content_text: 'world', content_order: 2&gt;] 
  </code></pre>
  
  <p>appears it is a ActiveRecord::Associations::CollectionProxy</p>
  
  <pre><code>page.content.class
  =&gt; ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_PageContent
  </code></pre>
  
  <p>anyone got any ideas?</p>
  
  <p>cheers</p>