title: What is an ActiveRecord Rails Relation really?
body: <p>I was trying to understand some of the internals of Rails Relations, in order to use them effectively in queries. Therefore, I opened up a console and did some tests:</p>
  
  <pre><code>ruby-1.9.2-p180 :036 &gt; Skill.where(:second_class =&gt; 'Wealth Ranger').map {|att| att.class}
   =&gt; [Skill(id: integer, name: string, description: string, second_class: string, third_class: string, created_at: datetime, updated_at: datetime)]
  </code></pre>
  
  <p>Now, I would not expect that output. I would expect something like Relation or something similar. But it seems like it traverses every attribute and produces the type for each one.</p>
  
  <p>What is a Relation in Ruby's terms really? Is it a totally custom structure? If so, are there similarities between hashes and arrays, or should it be considered like a totally custom structure?</p>
  
  <p>EDIT:</p>
  
  <p>After some more testing, it seems like it just contains objects of that class. Is that how it operates?</p>