I would like to get some advice on migrations. New on Rails, I do no
exactly understand what is going on here.
I have created a table "tax" sucessfully using this code in a
class CreateTax < ActiveRecord::Migration
create_table :tax do |t|
t.column(:rate, :integer, :default => 0)
Later, in a second step, I tried to populate this table with test data
using this code:
class TestTax < ActiveRecord::Migration
tax = Tax.create(
:rate => 0,
:description => '(none}',
is_default => 0)
# more records...
This leads to "uninitialized constant TestTax::Tax" printed by rake.
Originally, I tried to follow the standard Rail conventions about
using plurals, but this did not work either. Only when I got an error
message about "Taxis" (??) I thought, well, plurals seems to cause
problems instead of being really helpfull, so I added:
Inflector.inflections do |inflect|
inflect.uncountable %w( tax )
What do I miss here?
I have other problems with migrations which let me think that I do not
really understand what is going on.
For example, I have the impression that the name of a migration is in
some respect taken into account. (I am not talking about the "xxx_"
part of course).
I tried to find my way but only got the impression of inconsistency.
Is there a good source of information of how rails Rails is really
managing Migrations, with all rules/assumptions?
Thanks for help in advance!