On Apr 6, 2012, at 11:21 AM, Patrick J. Collins wrote:
> I am working on a project that uses active_admin, and I found once
> building out all of the admin resource files, running rspec causes the
> following error:
>> /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:503:in `load_missing_constant': Expected /Users/patrick/coding/rails/foobar/app/admin/users.rb to define Users (LoadError)
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:192:in `block in const_missing'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:190:in `each'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:190:in `const_missing'
> from /Users/patrick/coding/rails/foobar/app/controllers/users/confirmations_controller.rb:1:in `<top (required)>'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:359:in `require_or_load'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:313:in `depend_on'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:225:in `require_dependency'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/engine.rb:438:in `each'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/engine.rb:438:in `block in eager_load!'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/engine.rb:436:in `each'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/engine.rb:436:in `eager_load!'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `instance_exec'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `run'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `each'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `run_initializers'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/application.rb:136:in `initialize!'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
> from /Users/patrick/coding/rails/foobar/config/environment.rb:5:in `<top (required)>'
> from /Users/patrick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
> from /Users/patrick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
> from /Users/patrick/coding/rails/foobar/spec/spec_helper.rb:3:in `<top (required)>'
> from /Users/patrick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
> from /Users/patrick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
> from /Users/patrick/coding/rails/foobar/spec/controllers/locations_controller_spec.rb:1:in `<top (required)>'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
> from /Users/patrick/.rvm/gems/ruby-1.9.3-p125 at foobar/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
>>> ... Changing the filename app/admin/users.rb to app/admin/wtfs.rb
>> makes this error go away... so--- wtfs indeed!
>> incidentally if you are wondering what is this business with
> confirmations_controller (in the stack trace), that just inherits from Devise:
>> class Users::ConfirmationsController < Devise::ConfirmationsController
> end
>>> Patrick J. Collins
>http://collinatorstudios.com>> _______________________________________________
> rspec-users mailing list
>rspec-users at rubyforge.org>http://rubyforge.org/mailman/listinfo/rspec-users
I'm pretty sure this is an issue with how Rails autoloads things, I've run into it a few times. Checkout this post:
http://stackoverflow.com/questions/4074830/adding-lib-to-config-autoload-paths-in-rails-3-does-not-autoload-my-module