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
Related
I'm getting this error using Ubuntu + Apache + Passenger.
The problem is that I'm not using any database or model.
undefined method `has_one_attached' for #<Class:0x0000555c6ad94fd8> (NoMethodError)
/usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
/usr/local/rvm/gems/ruby-2.5.1/gems/activestorage-5.2.1/app/models/active_storage/blob/representable.rb:7:in `block in <module:Representable>'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/concern.rb:122:in `class_eval'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/concern.rb:122:in `append_features'
/usr/local/rvm/gems/ruby-2.5.1/gems/activestorage-5.2.1/app/models/active_storage/blob.rb:23:in `include'
/usr/local/rvm/gems/ruby-2.5.1/gems/activestorage-5.2.1/app/models/active_storage/blob.rb:23:in `<class:Blob>'
/usr/local/rvm/gems/ruby-2.5.1/gems/activestorage-5.2.1/app/models/active_storage/blob.rb:16:in `<main>'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:374:in `block in require_or_load'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:13:in `loading'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:37:in `load_interlock'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:352:in `require_or_load'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:330:in `depend_on'
/usr/local/rvm/gems/ruby-2.5.1/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:82:in `depend_on'
/usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:244:in `require_dependency'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:477:in `each'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:477:in `block in eager_load!'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:475:in `each'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:475:in `eager_load!'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:356:in `eager_load!'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application/finisher.rb:69:in `each'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
/usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application.rb:361:in `initialize!'
/var/www/app/config/environment.rb:5:in `<top (required)>'
config.ru:3:in `require_relative'
config.ru:3:in `block in <main>'
/usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
/usr/local/rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
At least up to 5.2.4.3, ActiveStorage seems to initialize and inject its methods into ActiveRecord after Rails config/initializers are loaded.
If any initializer uses any model calling ActiveStorage macros, as has_one_attached or has_many_attached, those methods are missing by then.
For example, if you have a User model using has_one_attached :image , and you use User as your Devise model, Device initializer will refer User, and when User is loaded the method has_one_attached will be missing.
I added this code, taken from active_storage/engine, at the end of config/application.rb, and it worked for me.
# config/application.rb
require "active_storage/attached"
ActiveSupport.on_load(:active_record) do
extend ActiveStorage::Attached::Macros
end
Did you install ActiveStorage?:
rails active_storage:install:migrations
rails db:migrate
If you are not using any DB, you can't use it.
On Rails 6.1 this seems to work:
# config/application.rb
ActiveSupport.on_load(:active_record) do
include ActiveStorage::Reflection::ActiveRecordExtensions
ActiveRecord::Reflection.singleton_class.prepend(ActiveStorage::Reflection::ReflectionExtension)
include ActiveStorage::Attached::Model
end
I found this solution starting from Argenis's answer and mixing it with the one in this other SO
For me it has been solved removing this line
config/initializers/active_admin.rb
config.before_action :set_admin_locale
Attempting to do the Rails tutorial on railstutorial.org. I'm currently at the testing portion of the tutorial and I keep on getting an error when performing the test. The test file I created with 'generate StaticPages controller' command is as is, I have not modified it at all. When I enter in the command 'rails test' I get this error:
>/Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/abstract_controller/helpers.rb:152:in `rescue in block in modules_for_helpers': Missing helper file helpers//users/user/programming/odin/rails/sample_app/app/helpers/application_helper.rb_helper.rb (AbstractController::Helpers::MissingHelperError)
Here is the trace back:
> from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/abstract_controller/helpers.rb:149:in `block in modules_for_helpers'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/abstract_controller/helpers.rb:145:in `map!'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/abstract_controller/helpers.rb:145:in `modules_for_helpers'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/abstract_controller/helpers.rb:109:in `helper'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_controller/railties/helpers.rb:17:in `inherited'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/test_case.rb:11:in `<class:TestCase>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/test_case.rb:10:in `<module:ActionView>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/test_case.rb:8:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/rails-controller-testing-0.1.1/lib/rails-controller-testing.rb:16:in `block in <top (required)>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/base.rb:215:in `<class:Base>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/base.rb:139:in `<module:ActionView>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.1/lib/action_view/base.rb:10:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:5:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application/default_middleware_stack.rb:48:in `block in build_stack'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application/default_middleware_stack.rb:13:in `tap'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application/default_middleware_stack.rb:13:in `build_stack'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:504:in `default_middleware_stack'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:506:in `block in app'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `synchronize'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `app'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
from /Users/user/Programming/Odin/rails/sample_app/config/environment.rb:5:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:92:in `require'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:92:in `preload'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/user/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
If this is formatted and asked imporperly or what not I apologize, any help will be greatly appreciated I absolutely stumped.
Here is the github repo : https://github.com/JDjedi/sample_app
Rails version is 5.0 and ruby version is 2.3.0p0
application_helper.rb_helper.rb - is this how you called your helper? .rb is an extension. Thus could you change the name of the helper file to application_helper.rb and see if that works?
Edit:
Did you look at this question? Rails: AbstractController::Helpers::MissingHelperError - Missing helper file application_helper.rb_helper.rb
Here seems to be a working answer: https://stackoverflow.com/a/28269245/1010826
Simply rename the root folder to the same name. Not sure why that would work, though :)
Rails: 4.2.5
I'm using STI and needed to get all Subclasses.
But as in dev environment, rails does Lazy Loading. So Model.subclasses and Model.descendants always return []
Googling sent me to this issue: https://github.com/rails/rails/issues/3364
And the above issue suggested following solution to put as initializer:
ActionDispatch::Reloader.to_prepare do
Rails.application.eager_load!
end
And on that I'm getting following exception:
/Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/validations/validates.rb:120:in `rescue in block in validates': Unknown validator: 'PersenceValidator' (ArgumentError)
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/validations/validates.rb:117:in `block in validates'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/validations/validates.rb:113:in `each'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/validations/validates.rb:113:in `validates'
from /Users/vmac1/rails_projects/survd/app/models/sub_service.rb:7:in `<class:SubService>'
from /Users/vmac1/rails_projects/survd/app/models/sub_service.rb:1:in `<top (required)>'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:457:in `load'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:457:in `block in load_file'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:647:in `new_constants_in'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:456:in `load_file'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:354:in `require_or_load'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:494:in `load_missing_constant'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:184:in `const_missing'
from /Users/vmac1/rails_projects/survd/app/models/buffet_service.rb:1:in `<top (required)>'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:457:in `load'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:457:in `block in load_file'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:647:in `new_constants_in'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:456:in `load_file'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:354:in `require_or_load'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:317:in `depend_on'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:233:in `require_dependency'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/engine.rb:471:in `each'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/engine.rb:471:in `block in eager_load!'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/engine.rb:469:in `each'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/engine.rb:469:in `eager_load!'
from /Users/vmac1/rails_projects/survd/config/initializers/eagerload_subclasses.rb:2:in `block in <top (required)>'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:446:in `instance_exec'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:446:in `block in make_lambda'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:192:in `call'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:192:in `block in simple'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:in `call'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:in `block in call'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:in `each'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:in `call'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/railties-4.2.5/lib/rails/application.rb:352:in `initialize!'
from /Users/vmac1/rails_projects/survd/config/environment.rb:5:in `<top (required)>'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application.rb:92:in `preload'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application.rb:143:in `serve'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application.rb:131:in `block in run'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application.rb:125:in `loop'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application.rb:125:in `run'
from /Users/vmac1/.rvm/gems/ruby-2.2.3/gems/spring-1.6.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/vmac1/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
As others have said, the actual error is a validation typo. But in regards to the original problem, Rails 4.2 eager-loads all classes in production by default, so you'd just have to change the eager_load and cache_classes setting in your other environments to get the same behavior. However, this will make development much more unpleasant since you'll have to restart the server every time you make a code change.
What is the underlying problem you're trying to solve by listing all subclasses? There might be another design that would avoid that requirement.
Typo of persence instead of presence
Since adding the devise gem, heroku is unable to load my application in production, giving me the application error:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
The specific error log from the console is
/app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise_controller.rb:13:in `<class:DeviseController>': undefined local variable or method `mimes_for_respond_to' for DeviseController:Class (NameError)
from /app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise_controller.rb:2:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:360:in `require_or_load'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:494:in `load_missing_constant'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:184:in `const_missing'
from /app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise/confirmations_controller.rb:1:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:360:in `require_or_load'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:317:in `depend_on'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:233:in `require_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:471:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:471:in `block in eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:469:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:469:in `eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:346:in `eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application/finisher.rb:56:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:352:in `initialize!'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:328:in `require_environment!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:67:in `console'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require'
from /app/bin/rails:8:in `<main>'
I have tried multiple suggestions floating around the internet, but none have worked so far. Thanks in advance!
A fast google search relates your issue with the responders gem, that needs to be updated. Please look at this issue in Devise gem. As long as responders is a Devise dependency, you don't need to include it in the Gemfile (double check that in your Gemfile.lock), you just need to update to the last version with:
bundle update responders
In the case that responders gem is not available, then add gem 'responders' to your Gemfile before running the previous command.
Hope it helps.
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?