我有一个模型,比如说User
,还有一个Admin
继承自的模型User
。我在lib
使用这两个模型的文件夹中有一些代码。但是,如果我安装一个新数据库并尝试运行迁移 rails 崩溃说没有User
. 是否有绕过此错误的最佳实践?
`Mysql2::Error: Table 'testing_interface_development.users' doesn't exist: SHOW FULL FIELDS FROM `users`
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:9:in `query'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:9:in `query_with_reconnect'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:31:in `block in execute'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:31:in `execute'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:259:in `execute_and_free'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:228:in `yield'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:228:in `columns'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:237:in `columns_hash'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/base.rb:455:in `relation'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/scoping/named.rb:37:in `scoped'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress@test_interface_install/gems/activerecord-3.2.11/lib/active_record/querying.rb:9:in `where'
/home/arthurborisow/Programming/my_project/test_interface/app/models/admin.rb:15:in `<class:Admin>'
/home/arthurborisow/Programming/my_project/test_interface/app/models/admin.rb:1:in `<top (required)>'`