开发者

Rails rake db:migrate aborts with generated model

Can someone tell me what I have done wrong?

I ran script/generate model CityZipMSA city:string state:string zip:integer MSA:integer

And then ran rake db:migrate and I get the following error

(in /Users/MMyself/app_dev/property) rake aborted! An error has occurred, this and all later migrations canceled:

uninitialized constant CreateCityZipMsas

My migration file:

    class CreateCityZipMSAs < ActiveRecord::Migration
  def self.up
    create_table :city_zip_msas do |t|
      t.string :city
      t.string :state
      t.integer :zip
      t.integer :MSA

      t.timestamps
    end
  end

  def self.down
    drop_table :city_zip_msas
  end
end

When I run rake db:migrate --trace

I get

(in /Users/MMyself/app_dev/property) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! An error has occurred, this and all later migrations canceled:

uninitialized constant CreateCityZipMsas /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in load_missing_constant' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:inconst_missing' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in const_missing' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/inflector.rb:364:inconstantize' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in each' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:inconstantize' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-2.3.8/lib/active_support/core_ext/string/inflections.rb:162:in constantize' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:374:inload_migration' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:369:in migration' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:inmigrate' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:491 /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:565:in call' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:565:inddl_transaction' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction' /Users/MMyself/.rvm/gems/ruby-开发者_Python百科1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/transactions.rb:182:intransaction' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:565:in ddl_transaction' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:490:inmigrate' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in each' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record>/migration.rb:477:inmigrate' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in up' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:inmigrate' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rails-2.3.8/lib/tasks/databases.rake:112 /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:636:in call' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:636:inexecute' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:631:in each' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /Users/MMyself/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/monitor.rb:242:insynchronize' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:583:ininvoke' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2029:in each' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2001:in run' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake.rb:1998:in run' /Users/MMyself/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/bin/rake:31 /Users/MMyself/.rvm/rubies/ruby-1.8.7-p249/bin/rake:24:inload' /Users/MMyself/.rvm/rubies/ruby-1.8.7-p249/bin/rake:24


You have:

class CreateCityZipMSAs < ActiveRecord::Migration

And the error is:

uninitialized constant CreateCityZipMsas

Try to rename your migration to CreateCityZipMsas.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜