-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
We have a mysql database that contains the majority of our models, and we'd like to add some mongoid classes. However, after adding the mongoid gem to the Gemfile, I encounter the following types of errors:
rcammer:bpx rcammer$ clear; bundle exec rake db:migrate --trace
...
rake aborted!
Mysql2::Error: Table 'bpx_development.building_types' doesn't exist: SHOW FULL FIELDS FROM building_types
...
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:469:in `load'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:469:in `block in load_file'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:639:in `new_constants_in'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:468:in `load_file'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:353:in `require_or_load'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:313:in `depend_on'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/activesupport-3.2.7/lib/active_support/dependencies.rb:225:in `require_dependency'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:121:in `load_model'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:96:in `block (2 levels) in load_models'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:95:in `each'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:95:in `block in load_models'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:87:in `each'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/rails/mongoid.rb:87:in `load_models'
/Users/rcammer/.rvm/gems/ruby-1.9.3-p194@bp/gems/mongoid-3.0.3/lib/mongoid/railtie.rb:126:in `block (2 levels) in <class:Railtie>'
...
I also tried this in my application.rb:
config.mongoid.preload_models = false
No dice. Any ideas?