# Migrations

**URL:** <https://www.ruby-forum.com/t/migrations/90838>\
**Category:** Rails\
**Created:** [April 2, 2007, 8:28am UTC](https://www.ruby-forum.com/t/migrations/90838 "2007-04-02T08:28:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 2, 2007, 8:28am UTC](https://www.ruby-forum.com/t/migrations/90838/1 "2007-04-02T08:28:13Z")

</div>

Hi there

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  
migration file:

class CreateTax \< ActiveRecord::Migration  
def self.up  
create\_table :tax do |t|  
t.column(:rate, :integer, :default =\> 0)  
# more  
end  
end

def self.down  
drop\_table :tax  
end  
end

Later, in a second step, I tried to populate this table with test data  
using this code:

class TestTax \< ActiveRecord::Migration  
def self.up  
down

```
tax = Tax.create(
      :rate => 0,
      :description => '(none}',
      is_default => 0)
tax.save!
# more records...

```

end

def self.down  
Tax.delete\_all  
end  
end

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 )  
end

to environment.rb

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!

Kai
