Just started playing with Ruby (no IT background) and restarted the project based on previous question / answer (link). I have got the following situation now:
created a currencymaster table with the following columns id:integer
, description:string
and isocode:string
whereby the ID column is created by Ruby.
created a currencyrates table with the following columns id:integer
, dominant:integer
and converted:integer
and rate:decimal
whereby the ID column is created by Ruby.
Based on help on this site I created the following models. The models/currencymaster.rb looks like this:
class Currencymaster < ActiveRecord::Base
has_many :currency_rates_dominant, :validate => true, :class_name => 'Currencyrate'
has_many :currency_rates_converted, :validate => true, :class_name => 'Currencyrate'
end
The models/currencyrate.rb looks like this:
class Currencyrate < ActiveRecord::Base
belongs_to :currency_master_doms, :class_name => 'Currencymaster'
belongs_to :currency_master_convs, :class_name => 'Currencymaster'
end
I haven't changed anything yet in the both controllers.
The views\currencyrates\index.html.erb is generated automatically via Ruby and is showing the values of the records as integer. The goal is to show the currencymaster.iso
value out of the Currencymaster
table for both currencyrate.dominant
and currencyrate.converted
Thanks a lot!!