Error on Rails Admin install. Possibly Devise related? - ruby-on-rails

Sorry to copy in this entire log, but I'm hoping it might make more sense to someone familiar with this issue. When devise began setting up the user model I wasn't given the option (I never pressed enter) and the install proceeded and crashed, outputting the following. Thanks!
? What would you like the user model to be called? Press <enter> for [user] > - Now setting up devise with user model name 'user':
generate devise
invoke active_record
create db/migrate/20120825075751_add_devise_to_users.rb
insert app/models/user.rb
route devise_for :users
- Now you'll need an initializer...
create config/initializers/rails_admin.rb
/home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `block in source_reflection': undefined method `klass' for nil:NilClass (NoMethodError)
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `collect'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `source_reflection'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:375:in `rescue in foreign_key'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:373:in `foreign_key'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:259:in `association_foreign_key_lookup'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:71:in `block in associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:64:in `map'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:64:in `associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:29:in `block (2 levels) in polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:28:in `each'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:28:in `block in polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:27:in `tap'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:27:in `polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:222:in `association_model_lookup'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:69:in `block (2 levels) in associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:49:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:49:in `associated_model_config'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:19:in `block in <class:PolymorphicAssociation>'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:68:in `instance_eval'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:68:in `block in register_instance_option'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:42:in `block in register_instance_option'
from (erb):86:in `block (2 levels) in template'
from (erb):85:in `map'
from (erb):85:in `block in template'
from (erb):82:in `map'
from (erb):82:in `template'
from /home/funkdified/.rvm/rubies/ruby-1.9.3-p125-HEAD/lib/ruby/1.9.1/erb.rb:838:in `eval'
from /home/funkdified/.rvm/rubies/ruby-1.9.3-p125-HEAD/lib/ruby/1.9.1/erb.rb:838:in `result'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/file_manipulation.rb:111:in `block in template'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:54:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:54:in `render'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `open'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `block in invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/empty_directory.rb:133:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/empty_directory.rb:133:in `invoke_with_conflict_check'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:61:in `invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions.rb:95:in `action'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:26:in `create_file'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/file_manipulation.rb:110:in `template'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/generators/rails_admin/install_generator.rb:59:in `install'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/generators.rb:171:in `invoke'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/commands.rb:29:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

I figured it out. I installed devise first to debug and found it was an issue with my existing User model. I needed to drop the User table and start over.

Related

NoMethodError: undefined method `each' for nil:NilClass on user creation rails

When I run my rails 5.1 app in development, everything is fine but when I run it on Heroku and try to create a user I keep getting this error.
NoMethodError: undefined method `each' for nil:NilClass
/app/vendor/bundle/ruby/2.4.0/gems/mongo-2.5.3/lib/mongo/cluster.rb:192:in `initialize'
/app/vendor/bundle/ruby/2.4.0/gems/mongo-2.5.3/lib/mongo/client.rb:454:in `new'
/app/vendor/bundle/ruby/2.4.0/gems/mongo-2.5.3/lib/mongo/client.rb:454:in `create_from_addresses'
/app/vendor/bundle/ruby/2.4.0/gems/mongo-2.5.3/lib/mongo/client.rb:253:in `initialize'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients/factory.rb:64:in `new'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients/factory.rb:64:in `create_client'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients/factory.rb:27:in `create'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients.rb:69:in `block in with_name'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients.rb:68:in `synchronize'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients.rb:68:in `with_name'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistence_context.rb:110:in `client'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistence_context.rb:70:in `collection'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/clients/options.rb:73:in `collection'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/contextual/mongo.rb:342:in `initialize'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/contextual.rb:53:in `new'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/contextual.rb:53:in `create_context'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/contextual.rb:35:in `context'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/contextual.rb:20:in `exists?'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/validatable/uniqueness.rb:276:in `validate_root'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/validatable/uniqueness.rb:48:in `block in validate_each'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/validatable/queryable.rb:23:in `with_query'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/validatable/uniqueness.rb:42:in `validate_each'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validator.rb:150:in `block in validate'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validator.rb:147:in `each'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validator.rb:147:in `validate'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:413:in `block in make_lambda'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:178:in `block (2 levels) in halting_and_conditional'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:600:in `catch'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:600:in `block in default_terminator'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:179:in `block in halting_and_conditional'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:507:in `block in invoke_before'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:507:in `each'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:507:in `invoke_before'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:130:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/interceptable.rb:132:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validations.rb:405:in `run_validations!'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validations/callbacks.rb:110:in `block in run_validations!'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:131:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/interceptable.rb:132:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:825:in `_run_validation_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validations/callbacks.rb:110:in `run_validations!'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validations.rb:335:in `valid?'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/validatable.rb:97:in `valid?'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.0/lib/active_model/validations.rb:372:in `invalid?'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistable/creatable.rb:117:in `prepare_insert'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistable/creatable.rb:23:in `insert'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistable/savable.rb:23:in `save'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/persistable/savable.rb:44:in `save!'
/app/db/seeds.rb:15:in `block in <top (required)>'
/app/db/seeds.rb:4:in `times'
/app/db/seeds.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in `load'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in `block in load'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in `load'
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-7.0.1/lib/mongoid/railties/database.rake:20:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
I can't place what could be causing the error. It is running a DB on mongoid in mlab. Not sure if that is the cause. I can't seed the db in heroku console without getting the same error.
It looks like the Mongo driver is expecting to iterate across a number of host URIs, but has somehow managed to reach that point in the code without detecting that there aren't any defined.
As you're using Mongoid to interact with the (slight lower level) Mongo Ruby client, this file on configuration might give you some clues. You'll probably want to also refer to the documentation for whichever MongoDB add-on you have installed on Heroku.

Trouble installing Devise

I am using rails for a quick project. I try to run rake:db migrate after rails g devise User on the command line and I get this error log:
Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:457:in `ensure in with_devise_exclusive_scope': undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007fcbe5e766f8> (NoMethodError)
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:457:in `with_devise_exclusive_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:248:in `block (2 levels) in devise_for'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:351:in `block in devise_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:940:in `block in constraints'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:816:in `scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:940:in `constraints'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:350:in `devise_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:247:in `block in devise_for'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:223:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:223:in `devise_for'
from /Users/ashleighalmeida/Rails-Blog/config/routes.rb:3:in `block in <top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:410:in `draw'
from /Users/ashleighalmeida/Rails-Blog/config/routes.rb:1:in `<top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in `execute'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:81:in `block (2 levels) in <module:Finisher>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:446:in `instance_exec'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:446:in `block in make_lambda'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `block in simple'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `block in call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_prepare_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:153:in `serve'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
I configured it in enviornment.rb, added my alerts, what could be the problem?
There is a bug in this version of Devise with Rails. You can update to a newer version.
This should help you to solve the problem.
That's because you hadn't properly installed Devise when you generated the User model.
To resolve this problem, run this command
rails g devise:install

Rails mountable Engine + Devise

I am doing Authentication app using Devise (as Engine). I followed the steps from this link every thing goes perfectly until i reach the command
rails generate devise MODEL
from the above link after this command it shows some errors
invoke active_record
create db/migrate/20140901111733_devise_create_fd_users.rb
/Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_handling.rb:87:in `connection'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:86:in `postgresql?'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:78:in `inet?'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:74:in `ip_column'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:56:in `migration_data'
from (erb):4:in `migration_template'
from /Users/user/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/erb.rb:838:in `eval'
from /Users/user/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/erb.rb:838:in `result'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:64:in `block in migration_template'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:34:in `create_migration'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:63:in `migration_template'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:16:in `copy_devise_migration'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:277:in `block in _invoke_for_class_method'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/shell.rb:68:in `with_padding'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:266:in `_invoke_for_class_method'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:149:in `_invoke_from_option_orm'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators.rb:157:in `invoke'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/commands/generate.rb:11:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/engine/commands.rb:19:in `<top (required)>'
from bin/rails:12:in `require'
from bin/rails:12:in `<main>'
I thought Database connection not established properly so i tested using the command
rails generate model Test name:string email:string
its working properly, then i gave
rake db:migrate
Now database also migrated successfully, so i think database connection is properly working. The commands mentioned above were run from Engine's Directory. If any information needed comment it out i will provide the details. Thanks
Use devise 3.2.x instead of devise 3.3.x

Broken rails environment: can't run rails generate scaffold

I have a mystery: My rvm/ruby-1.9.2 environment, running rails 3.1.3, can no longer run this command
rails generate scaffold Game name:string difficulty:string
I get the following dump after a 'method missing' failure
kenb#stargate:~/development/sudoku$ rails g scaffold Game name:string difficulty:string
invoke active_record
/home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/base.rb:1088:in `method_missing': undefined method `mass_assignment_sanitizer=' for ActiveRecord::Base:Class (NoMethodError)
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/railtie.rb:59:in `block (3 levels) in <class:Railtie>'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/railtie.rb:58:in `each'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/railtie.rb:58:in `block (2 levels) in <class:Railtie>'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/base.rb:2190:in `<top (required)>'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/generators/named_base.rb:165:in `pluralize_table_names?'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/generators/named_base.rb:112:in `table_name'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/rails/generators/active_record/model/model_generator.rb:17:in `create_migration_file'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_orm'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/generators.rb:168:in `invoke'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /home/kenb/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands.rb:28:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have gone so far as to remove rvm and all dependent gems, re-install rvm, ruby-1.9.2, and then run 'bundle install' in my app folder. All goes well. Then, I get a failure on the generate command.
According to http://apidock.com/rails/ActiveModel/MassAssignmentSecurity/ClassMethods/mass_assignment_sanitizer%3D mass_assignment_sanitizer was introduced in rails 3.2, while you are using 3.1.3. Haven't you generated you project with rails 3.2?

rake db:schema:load could not find a table

EDIT from normalocity: My answer hasn't been able to solve this problem, so I'm posting a bounty for alternate solutions.
Original question:
I started to work on a Rails project a week ago, changing many times the database schema using migrations. Yesterday I try to create my database (developement environnement, default configuration) from scratch using these commands :
rake db:drop
rake db:create
rake db:schema:load
I got this message when loading the schema using --trace option :
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Could not find table 'galleries'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:439:in `table_structure'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:322:in `columns'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `block (2 levels) in initialize'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:92:in `block in initialize'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `yield'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `default'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:106:in `block in initialize'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb:717:in `yield'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb:717:in `default'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb:717:in `columns_hash'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/locking/optimistic.rb:145:in `locking_enabled?'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/relation.rb:110:in `to_a'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/relation/finder_methods.rb:159:in `all'
/var/lib/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb:441:in `all'
/home/fabien/Dropbox/portfolio/app/admin/photos.rb:10:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/dsl.rb:13:in `instance_eval'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/dsl.rb:13:in `run_registration_block'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/namespace.rb:171:in `parse_registration_block'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/namespace.rb:50:in `register'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/application.rb:87:in `register'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin.rb:60:in `register'
/home/fabien/Dropbox/portfolio/app/admin/photos.rb:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `block in load!'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `each'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/application.rb:132:in `load!'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/application.rb:155:in `routes'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin.rb:63:in `routes'
/home/fabien/Dropbox/portfolio/config/routes.rb:9:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:258:in `instance_exec'
/var/lib/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:258:in `eval_block'
/var/lib/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:235:in `draw'
/home/fabien/Dropbox/portfolio/config/routes.rb:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `each'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `load_paths'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:13:in `reload!'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:87:in `reload_routes!'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:34:in `reload!'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:28:in `block in initialize'
/ var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in `call'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/var/lib/gems/1.9.1/gems/activeadmin-0.3.4/lib/active_admin/reloader.rb:45:in `block in attach!'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/callbacks.rb:404:in `_run_prepare_callbacks'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/lib/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/reloader.rb:46:in `prepare!'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/fabien/Dropbox/portfolio/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/lib/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/var/lib/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'
Tasks: TOP => db:schema:load => environment
As Rails beginner, I have no idea how to solve this issue especially my schema.rb have commands to create th galleries table.
My code is available here: https://github.com/fabienengels/portfolio
You need to modify your /app/admin/photos.rb
# /app/admin/photos.rb
index :as => :grid, :columns => 6 do |photo|
Gallery.all.each do |gallery|
scope gallery.slug.to_sym do |photos|
photos.where(:gallery_id => gallery)
end
end
# link_to(image_tag(photo.file.url(:thumb)), admin_photo_path(photo))
end
you need to put that code inside the index block. I commented out your link tag there. I'll leave it up to you to figure out how to design your grid/block/whatever. just make sure it's in the index scope. Good luck.
So the issue is that when your app loads, it's loading up your activeadmin stuff. That in turn ends up running Gallery.all to know what scopes to setup.
Running a rake task like schema:load still loads the app, so it's still trying to do Gallery.all but you've just dropped/recreated the db so it's quite rightly saying that the table isn't there.
What you'd like to be able to do is tell ActiveAdmin not to bother configuring itself, as you're just running some migrations.
Luckily, there is a global variable $rails_rake_task that is set in those cases. I'd try not running the code in your active_admin initialiser whenever $rails_rake_task is true or if that doesn't work also not doing any activeadmin configuration (e.g. the stuff in app/admin/photos) if $rails_rake_task is true.
I've never used ActiveAdmin before, but from the documentation, but it seems like you can only reference a single model within an ActiveAdmin.register block, or that you simply haven't made the Gallery model visible inside of this file.
So, in app/admin/photos.rb where you have
ActiveAdmin.register Photo do
...
Gallery.all.each do |gallery| # <= this is invalid, because this file
scope gallery.slug.to_sym do |photos| # doesn't know what `Gallery` (and therefore
photos.where(:gallery_id => gallery) # `galleries` table`) is referring to
end
end
....
end
I'm not sure how to do nested ActiveAdmin registrations, or even if you can, but the error message you're getting is telling you that Gallery is not accessible within the scope of this file, and therefore, it's like, "What 'galleries table? We have no 'galleries' table here.".
So, you could try one of these two things to resolve it and see what happens - hopefully this is either the answer, or will lead you to the answer:
At the very top of the app/admin/photos.rb file, add this exact line:
require '../models/gallery'
If that doesn't work, then instead of Gallery.all.each... try
ActiveAdmin.register Gallery do followed by that same block

Resources