title: dynamically get rails association
body: <p>If I have an association name as a string, is there a way I can get a handle on the association object?</p>
  
  <p>For example:</p>
  
  <pre><code>o = Order.first
  </code></pre>
  
  <p>o.customer will give me the customer object that this order belongs to.</p>
  
  <p>If I have:</p>
  
  <pre><code>o = Order.first
  relationship = 'customer'
  </code></pre>
  
  <p>i would like to do something like:</p>
  
  <pre><code>customer = eval("o.#{relationship}")
  </code></pre>
  
  <p>I know eval is a terrible option and I should avoid it. What is the best way to do this (as eval does not work in this example).</p>
  
  <p>I did have this working:</p>
  
  <pre><code>customer = o.association(relationship)
  </code></pre>
  
  <p>I later found out that the association is not part of the public API and should not be used. Because when I took a line of code I had higher up the page off (that referenced that relationship) it stopped working. </p>
  
  <p>Any ideas would be awesome!</p>