Load error in Rspec and full Rails engine - ruby-on-rails

I am trying to migrate Rails app to use Rails engines. My plan is to not use mountable engines for now and migrate to them later.
Folders structure looks like this:
config
engines
common
app
models
lib
common
namespaced_lib
web
app
controllers
helpers
views
config
features
lib
public
script
spec
vendor
Engines are defined like this:
module Common
class Engine < ::Rails::Engine
engine_dir = File.expand_path('../..', File.dirname(__FILE__))
config.autoload_paths += Dir[engine_dir + '/app/models/**/']
config.autoload_paths += Dir[engine_dir + '/lib/**/']
end
end
module Web
class Engine < ::Rails::Engine
end
end
There is a Data class in lib/common/namespaced_lib folder of Common engine. In code it is referenced only as NamespacedLib::Data and never as Data.
module NamespacedLib
class Data
end
end
And there is a DataController (inside of engines/web/app/controllers):
class DataController < ApplicationController
end
When I run rspec I get following error. This error never happened before I moved to engines.
rspec
/.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:503:in `load_missing_constant': Expected /engines/common/lib/common/namespaced_lib/data.rb to define Data (LoadError)
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:192:in `block in const_missing'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `each'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `const_missing'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:230:in `block in constantize'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `each'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `constantize'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:260:in `safe_constantize'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/core_ext/string/inflections.rb:66:in `safe_constantize'
from /.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.19/lib/action_controller/metal/params_wrapper.rb:152:in `_default_wrap_model'
from /.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.19/lib/action_controller/metal/params_wrapper.rb:169:in `_set_wrapper_defaults'
from /.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.19/lib/action_controller/metal/params_wrapper.rb:133:in `inherited'
from /.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.19/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with'
from /.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.19/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with'
from /engines/web/app/controllers/data_controller.rb:1:in `<top (required)>'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:359:in `require_or_load'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:313:in `depend_on'
from /.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:225:in `require_dependency'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:444:in `block (2 levels) in eager_load!'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:443:in `each'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:443:in `block in eager_load!'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:441:in `each'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:441:in `eager_load!'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/application/railties.rb:8:in `each'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/application/railties.rb:8:in `all'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/engine.rb:439:in `eager_load!'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `instance_exec'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `block in run_initializers'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `each'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
from /.rvm/gems/ruby-2.1.2/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /config/environment.rb:14:in `<top (required)>'
from /spec/spec_helper.rb:46:in `require'
from /spec/spec_helper.rb:46:in `block in <top (required)>'
from /.rvm/gems/ruby-2.1.2/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
from /spec/spec_helper.rb:40:in `<top (required)>'
from /spec/controllers/approvals_controller_spec.rb:1:in `require'
from /spec/controllers/approvals_controller_spec.rb:1:in `<top (required)>'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
from /.rvm/gems/ruby-2.1.2/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
I tried to rename DataController to DataRenamedController and the error went away. So it looks like Rails or Rspec tries to auto-load Data class when it sees DataController. Is there a way to disable this?

Related

Cannot define multiple 'included' blocks for a Concern with sidekiq

I am experiencing the below exception if I am running the sidekiq:
It can be seen that the date_at_relative_to_now class is required twice by some weird reason despite the fact that I am not using require nor require_relative in my application. I am relying exclusively to rails autoload feature.
Any ide or help is appreciated
→ sidekiq
loading...
loading...
Cannot define multiple 'included' blocks for a Concern
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/concern.rb:126:in `included'
/Users/boti/Rails/checker/app/exhibits/concerns/date_at_relative_to_now.rb:6:in `<module:DateAtRelativeToNow>'
/Users/boti/Rails/checker/app/exhibits/concerns/date_at_relative_to_now.rb:3:in `<top (required)>'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `load'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `block in load_file'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:647:in `new_constants_in'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:456:in `load_file'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:354:in `require_or_load'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:317:in `depend_on'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:233:in `require_dependency'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:471:in `each'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:471:in `block in eager_load!'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:469:in `each'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:469:in `eager_load!'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/engine.rb:346:in `eager_load!'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/application/finisher.rb:56:in `each'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `call'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
/Users/boti/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
/Users/boti/Rails/checker/config/environment.rb:5:in `<top (required)>'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:241:in `boot_system'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:50:in `run'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/gems/sidekiq-3.3.4/bin/sidekiq:8:in `<top (required)>'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/bin/sidekiq:23:in `load'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/bin/sidekiq:23:in `<main>'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/bin/ruby_executable_hooks:15:in `eval'
/Users/boti/.rvm/gems/ruby-2.2.0#checker/bin/ruby_executable_hooks:15:in `<main>'
ruby-2.2.0#checker:boti:~/Rails/checker git:active_job_exercise
→
The code for date_at_relative_to_now.rb:
module DateAtRelativeToNow
puts 'loading...'
extend ActiveSupport::Concern
included do
include ActionView::Helpers::DateHelper
end
module ClassMethods
attr_reader :field
def applicable_to?(object, _context)
field = self.field
object.respond_to? field
end
def applicable_to(field)
#field = field
define_method field do
date = __getobj__.send self.__class__.field
if date.present?
"#{distance_of_time_in_words_to_now date} ago"
else
'Never'
end
end
end
end
end
Issue occuring as activesupport does not support include inside 'included' block.
Remove include ActionView::Helpers::DateHelper line from DateAtRelativeToNow and included it in module or class wherever you need.
Implemention of activesupport 'included' function:
def included(base = nil, &block)
if base.nil?
raise MultipleIncludedBlocks if instance_variable_defined?(:#_included_block)
#_included_block = block
else
super
end
end

Circular dependency on nested concern

Any got any idea why, on my production server I can't use nested concerns in model?
I have a model Landing
class Landing < ActiveRecord::Base
include Claimable
end
and concern
module Claimable
extend ActiveSupport::Concern
end
Everything is working fine, but Claimable is stricly Landing logic so I would like to put it a nested route
class Landing < ActiveRecord::Base
include Landing::Claimable
end
and
module Landing::Claimable
extend ActiveSupport::Concern
end
This is working on my developement machine (OSX Yosemite), but when I deploy to a Linux production server I receive error:
/home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:492:in `load_missing_constant': Circular dependency detected while autoloading constant Landing::Claimable (RuntimeError)
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/app/models/landing.rb:20:in `<class:Landing>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/app/models/landing.rb:18:in `<top (required)>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:in `require_or_load'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/app/models/concerns/landing/claimable.rb:1:in `<top (required)>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:in `require_or_load'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:317:in `depend_on'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:233:in `require_dependency'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:471:in `each'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:471:in `block in eager_load!'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:469:in `each'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:469:in `eager_load!'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:346:in `eager_load!'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/application/finisher.rb:56:in `each'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from /home/app/app/current/config/environment.rb:5:in `<top (required)>'
from /home/app/app/current/config.ru:3:in `require'
from /home/app/app/current/config.ru:3:in `block in <main>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/app/app/current/config.ru:1:in `new'
from /home/app/app/current/config.ru:1:in `<main>'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/rack/adapter/loader.rb:33:in `eval'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/rack/adapter/loader.rb:33:in `load'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/rack/adapter/loader.rb:42:in `for'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/controllers/controller.rb:170:in `load_adapter'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/controllers/controller.rb:74:in `start'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
from /home/app/app/releases/a34cd4a786d8f6c35179fb8eebc34469f471192a/vendor/bundle/ruby/2.1.0/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
from /home/app/app/releases/68f6492bb01f28373b95f26f34b609fdb99dc9cd/vendor/bundle/bin/thin:16:in `load'
from /home/app/app/releases/68f6492bb01f28373b95f26f34b609fdb99dc9cd/vendor/bundle/bin/thin:16:in `<main>'
This usually has to do with your config.eager_load settings on your application. You have a different setting in the production environment from the development one, which is perfectly normal and the intended use, but that's why you experience different behaviors from development to production.
As a possible solution, I suggest you avoid using the one-line namespaced class definition and change it to multiple lines instead.
Try changing:
module Landing::Claimable
end
to:
module Landing
module Claimable
end
end

Rails on Phusion Passenger application could not start - no such file to load

Ok, it's my first time spinning up a rails production server.
When I try to view the web app in a browser I get:
No such file to load -- /home/dan/RubymineProjects/RubyMineTest/config/environment (LoadError)
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/var/www/eReferral/eReferral/app/helpers/cpsa_util.rb:1:in `<top (required)>'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:330:in `require_or_load'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:289:in `depend_on'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:207:in `require_dependency'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:464:in `each'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:464:in `block in eager_load!'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:462:in `each'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:462:in `eager_load!'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:347:in `eager_load!'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:56:in `each'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
/home/administrator/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/eReferral/eReferral/config/environment.rb:9:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
/var/www/eReferral/eReferral/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/home/administrator/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.38/helper-scripts/rack-preloader.rb:112:in `eval'
/home/administrator/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.38/helper-scripts/rack-preloader.rb:112:in `preload_app'
/home/administrator/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.38/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/administrator/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.38/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/administrator/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.38/helper-scripts/rack-preloader.rb:28:in `<main>'
config.ru:
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
config/environment.rb:
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Load the app's custom environment variables here, so that they are loaded before environments/*.rb
app_env_variables = File.join(Rails.root, 'config', 'app_env_variables.rb')
load(app_env_variables) if File.exists?(app_env_variables)
# Initialize the Rails application.
RubyMineTest::Application.initialize!
Also, my tmp directory:
/tmp$ ls -LR
.:
cache restart.txt
./cache:
assets
./cache/assets:
production
./cache/assets/production:
sass sprockets
./cache/assets/production/sass:
4606f7a84f34e733d7175a61bab50f50e68daef5 96bb3524e75351d4a8c432c054b44f6fda057bac
736a3da50d4a76217e907f6d6eae90a427daa19b 9f36c8b8e68eb6dd6fd6b5fdb56562aeb25220a8
./cache/assets/production/sass/4606f7a84f34e733d7175a61bab50f50e68daef5:
_functions.scssc
./cache/assets/production/sass/736a3da50d4a76217e907f6d6eae90a427daa19b:
application.css.scssc favourites.css.scssc feedbacks.css.scssc foundation_and_overrides.css.scssc ref_docs.css.scssc
./cache/assets/production/sass/96bb3524e75351d4a8c432c054b44f6fda057bac:
foundation.scssc
./cache/assets/production/sass/9f36c8b8e68eb6dd6fd6b5fdb56562aeb25220a8:
_accordion.scssc _clearing.scssc _grid.scssc _offcanvas.scssc _reveal.scssc _tabs.scssc
_alert-boxes.scssc _dropdown-buttons.scssc _inline-lists.scssc _orbit.scssc _side-nav.scssc _thumbs.scssc
_block-grid.scssc _dropdown.scssc _joyride.scssc _pagination.scssc _split-buttons.scssc _tooltips.scssc
_breadcrumbs.scssc _flex-video.scssc _keystrokes.scssc _panels.scssc _sub-nav.scssc _top-bar.scssc
_button-groups.scssc _forms.scssc _labels.scssc _pricing-tables.scssc _switch.scssc _type.scssc
_buttons.scssc _global.scssc _magellan.scssc _progress-bars.scssc _tables.scssc _visibility.scssc
./cache/assets/production/sprockets:
059a75b3b827305fe269ef43b55f6c05 326c0fc33e26e4bdb6564b6e385e997b 80c0e44e1fcfb165924912e60049f1b8 c33305051314b3801e3ccd5604cfb201
066c7d624dbbf0ed9678d445626d67d9 34d4f1090a4964580f18bc41c4ec1823 81b353364eb95b005071988183e8d310 c8a0f1c9849286ba498dee6dbae54dca
067302be7fc4e929ed234394d639bf22 3914fbe7e0e79b3e5331a22fab31d97d 820bf24b1f63a672b27b677be3852f28 c8f2fb610bed5ffc78fca3ebeb34b976
090cecc1cbfcce778a17479ac1a949ec 392c860b952b8e0f8b8a683031312ca1 8341472a2bf229d9267e536f14216aef c99dbb16bdcb5995ee38001b377c504b
0937ee1bc51ee7ba190bf490d90ea272 393782a587ae4837b8944b742bdcad1a 83ec58aac2e6effa0403d2279f845a5d cdb00a3556bce86b1c04fbc8abaedfde
Here's what I don't understand. The path it lists /home/dan/RubymineProjects/RubyMineTest is from my development server. I've searched for anything hard coded but I can't find anything. I have no clue where it's getting this from.... any ideas?
I search again.... and this time I found one file that did have a couple of hard coded dependencies.
face palm
Thank you for your help

What should I do to make this rails app testable?

I have an up to date rails application, using rails 3.2 with mongoid 2. I was unable to start testing by typing rake. The exception thrown is (sanitized):
rake test
/railsapp/app/models/image.rb:18:in `<class:Image>': undefined method `[]' for nil:NilClass (NoMethodError)
from /railsapp/app/models/image.rb:1:in `<top (required)>'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
from /gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
from /gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /railsapp/config/environment.rb:7:in `<top (required)>'
from /railsapp/test/test_helper.rb:2:in `require'
from /railsapp/test/test_helper.rb:2:in `<top (required)>'
from /railsapp/test/unit/post_test.rb:1:in `require'
from /railsapp/test/unit/post_test.rb:1:in `<top (required)>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
Errors running test:units! #<RuntimeError: Command failed with status (1): [/Users/janlimpens/.rvm/rubies/ruby-1.9.3-p...]>
I created a gist with the files that are of interest in the context:
https://gist.github.com/3989760
There is no test concerning the image model at all, there are no fixtures and the only test I have got is included into the gist, but it is not to blame, the error is thrown upon including test_helper.rb.
What are my options?
When the tests start Rails loads up, as it does so it evaluates all of your models.
This includes the Image model, which apparently has a bug or typo on line 18.
Which would be this line:
:path => "#{APP_CONFIG['uploads_dir']}/:class/:id/:attachment/:style.:extension",
The only array notation here is:
APP_CONFIG['uploads_dir']
So, where is APP_CONFIG defined? And why is it a nil? These are the questions we must answer.
You might start by grepping your project for this string.

Rails superclass mismatch error with two controllers

I have two controllers
one is defined as
class Admin::Businesses::DealsController < AdminController
it is located at app/controllers/admin/businesses/deals_controller.rb
the other
class Admin::DealsController < AdminController
is located at app/controllers/admin/deals_controller.rb
Everything works find in development env but When I push to heroku and the app loads in production env it gives me this error
/app/app/controllers/businesses/deals_controller.rb:1:in `<top (required)>': superclass mismatch for class DealsController (TypeError)
related lines from my routes.rb look like this
namespace 'admin' do
resources :deals do
end
resources :businesses do
resources :deals, module: "businesses"
end
end
Why is it giving me this error, due to same name of controllers ? or super class mismatch ? How can I fix this. I want two controllers for deals one under admin and the other under admin/businesses for business specific actions.
Here is the full stack trace when trying to run the app locally in prod env using
rails s -e production
/home/abid/Projects/vocallocal/app/controllers/admin/businesses/deals_controller.rb:1: warning: toplevel constant Businesses referenced by Admin::Businesses
Exiting
/home/abid/Projects/vocallocal/app/controllers/businesses/deals_controller.rb:1:in `<top (required)>': superclass mismatch for class DealsController (TypeError)
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `block in eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/abid/Projects/vocallocal/config/environment.rb:5:in `<top (required)>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/abid/Projects/vocallocal/config.ru:4:in `block in <main>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/abid/Projects/vocallocal/config.ru:1:in `new'
from /home/abid/Projects/vocallocal/config.ru:1:in `<main>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Thanks
The problem is that your admin namespace in your routes is conflicting with your admin module in your class hierarchy. The details about why this is causing that specific error are complicated, but are explained in more detail at http://code.dblock.org/warning-toplevel-constant-xyz-referenced-adminxyz
The simplest solution is to rename one of your admins, probably the class name, to anything else.

Resources