title: How do you access an object's (ActiveRecord::Relation) value by key in Ruby on Rails?
body: <p>tl;dr How do I get the corresponding value with the key of an object?</p>
  
  <p>I'm confused why </p>
  
  <p><code>Atag.where(tag:'brand')</code> gives me what I would call an object for lack of a better term: <code>#&lt;ActiveRecord::Relation [#&lt;Atag id: 1, tag: "brand", created_at: "2015-01-31 04:29:20", updated_at: "2015-01-31 04:29:20"&gt;]&gt;</code></p>
  
  <p>But I'm having the basic difficult of accessing the corresponding value for the key :id.</p>
  
  <p><code>Atag.where(tag:'brand').id</code> and <code>Atag.where(tag:'brand')[:id]</code> and <code>Atag.where(tag:'brand')(:id)</code> all throw errors, while in this case I'm just trying to have the integer 1 returned.</p>
  
  <p>I seem to be unable to ruby, nor find a succinct answer to this basic question with my google searching skills (or lack there of).</p>
  
  <p>Thanks</p>