2

我正在为一个项目使用 Rails 3.2.3 和 Active Admin。当我尝试 rake 数据库时,它说:“类 BillingCycle 的超类不匹配”并将类的名称更改为其他东西会产生相同的错误。如果我取出 Active Admin 的东西(初始化程序、管理文件夹、路由),我就可以运行它,但我需要一个不需要我为每个 db:migrate 都这样做的解决方案。完整的跟踪是:

    superclass mismatch for class BillingCycle
/Users/ashley/public_afme/db/migrate/20120711022055_billing_cycle.rb:   1:in `<top (required)>'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/   active_support/dependencies.rb:251:in `require'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:537:in `load_migration'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:533:in `migration'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:528:in `migrate'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `call'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/transactions.rb:208:in `transaction'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `ddl_transaction'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:719:in `block in migrate'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:700:in `each'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:700:in `migrate'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:570:in `up'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/migration.rb:551:in `migrate'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/ashley/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/ashley/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

我能做些什么来解决这个问题?

4

1 回答 1

2

我认为您可能已将迁移命名为 BillingCycle。检查您的 BillingCycle 迁移文件顶部是否没有:class BillingCycle < ActiveRecord::Migration

如果是这样,将该类重命名为其他名称 - 也许是“AddingBillingCycle”。

于 2012-08-07T15:54:47.267 回答