Hi all
Here’s my migration:
class CreateCurrencies < ActiveRecord::Migration
def self.up
create_table :currencies do |t|
t.column :abbrevation, :string, :limit => 3, :null => false
t.column :name, :string, :null => false
t.column :multiplicator, :integer
end
add_index :currencies, :abbrevation, :unique => true, :name =>
:abbrevation_uniq
[ [“EUR”, “European Euros”, 1],
[“CHF”, “Swiss Francs”, 0.66],
[“USD”, “US American Dollars”, 0.75]
].each do |c|
Currency.create(:abbrevation => c[0],
:name => c[1],
:multiplicator => c[2])
end
end
def self.down
drop_table :currencies
end
end
The important part is where I fill some currencies into the created
table (EUR, CHF and USD). Sadly after running the script only the EUR is
stored in the table, no CHF and USD! I don’t really get why; migration
doesn’t raise any error or stuff…
Anybody sees the problem? Because I don’t!
Thanks, Joshua