title: How to show description fields from related table (2)
body: <p>Just started playing with Ruby (no IT background) and restarted the project based on previous question / answer (<a href="https://stackoverflow.com/questions/11630906/how-to-show-description-fields-from-related-table">link</a>). I have got the following situation now:</p>
  
  <p>created a <em>currencymaster</em> table with the following columns <code>id:integer</code> , <code>description:string</code> and <code>isocode:string</code> whereby the ID column is created by Ruby.</p>
  
  <p>created a <em>currencyrates</em> table with the following columns <code>id:integer</code> , <code>dominant:integer</code> and <code>converted:integer</code> and  <code>rate:decimal</code> whereby the ID column is created by Ruby.</p>
  
  <p>Based on <a href="https://stackoverflow.com/questions/2125440/activerecord-has-many-where-two-columns-in-table-a-are-primary-keys-in-table-b">help on this site</a> I created the following models.
  The <em>models/currencymaster.rb</em> looks like this:</p>
  
  <pre><code>class Currencymaster &lt; ActiveRecord::Base
    has_many :currency_rates_dominant, :validate =&gt; true, :class_name =&gt; 'Currencyrate' 
    has_many :currency_rates_converted, :validate =&gt; true, :class_name =&gt; 'Currencyrate' 
  end
  </code></pre>
  
  <p>The models/currencyrate.rb looks like this:</p>
  
  <pre><code>class Currencyrate &lt; ActiveRecord::Base
    belongs_to :currency_master_doms, :class_name =&gt; 'Currencymaster' 
    belongs_to :currency_master_convs, :class_name =&gt; 'Currencymaster' 
  end
  </code></pre>
  
  <p>I haven't changed anything yet in the both controllers.</p>
  
  <p>The <em>views\currencyrates\index.html.erb</em> is generated automatically via Ruby and is showing the values of the records as integer. The goal is to show the <code>currencymaster.iso</code> value out of the <code>Currencymaster</code> table for both <code>currencyrate.dominant</code> and <code>currencyrate.converted</code></p>
  
  <p>Thanks a lot!!</p>