title: Refer to model field by string variable that contains the name of the field?
body: <p>I can't figure out how to word this for a google search - pardon.   If I have a model like:</p>
  
  <pre><code>c = Color.all
  </code></pre>
  
  <p>I could say:</p>
  
  <pre><code>c.Color[0].color_name
  </code></pre>
  
  <p>So if I then have  a variable that contains the name of a field in that model like:</p>
  
  <pre><code>b = 'color_name'
  </code></pre>
  
  <p>How could I say ("c.color_name") like this using the string with the field name:</p>
  
  <pre><code>c[0].b  
  </code></pre>
  
  <p>Or, I mean tell Ruby/Rails to use the contents of the vaiable as the field name:</p>
  
  <pre><code>c[0].[the string value of b]
  </code></pre>
  
  <p>I've fumbled around trying everything I can think of but the syntax for this I can't figure out.</p>
  
  <p>Thanks!</p>
  
  <p>Rails 2.3.5 / Ruby 1.8.7</p>