This is a strange one, I have created the following migration which fails to run.
class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.column :name, :string
t.timestamps
end
news_category = Category.create(:name => 'Site News')
change_column :articles, :category_id, :integer, :default => news_category
end
end
When I run it I get the following error.
MrBernz:mylife bernardleung$ rake db:migrate --trace
(in /Users/bernardleung/Documents/My Development/mylife)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
An error has occurred, all later migrations canceled:
uninitialized constant CreateCatagories
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:364:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:374:in `load_migration'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:369:in `migration'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:491:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:in `ddl_transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:490:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in `each'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:in `migrate'
/Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:112
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Any ideas?
Bernard