Rails version: 6.0.2.1
Ruby version: 2.7.0p0
I added gem 'config' (https://github.com/rubyconfig/config) to my Rails 6 project, ran bundle install, and rails g config:install. Everything appeared to install correctly.
I can start the rails server successfully but when I actually open the app in the browser this lovely error (see below) is outputted in the Rails log and also outputted on to the page.
I have reproduced this on a fresh rails app following the same steps. However, this error only happened once a before_action was added to ApplicationController. Also, when I remove everything from my original projects ApplicationController, the error does not occur.
2020-05-02 15:34:53 -0700: Rack app error handling request { GET / }
#<NameError: uninitialized constant ActionText::Engine::ApplicationController>
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actiontext-6.0.2.1/lib/action_text/engine.rb:46:in `block (2 levels) in <class:Engine>'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:72:in `class_eval'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:72:in `block in execute_hook'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actiontext-6.0.2.1/lib/action_text/content.rb:132:in `<main>'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/zeitwerk-2.2.2/lib/zeitwerk/kernel.rb:23:in `require'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actiontext-6.0.2.1/lib/action_text/engine.rb:43:in `block (2 levels) in <class:Engine>'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:429:in `instance_exec'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:606:in `catch'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:202:in `block in halting'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `each'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `invoke_before'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:119:in `complete!'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:76:in `block in run!'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:70:in `tap'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:70:in `run!'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.0.8/lib/rack/sendfile.rb:111:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/host_authorization.rb:77:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/webpacker-4.2.2/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/railties-6.0.2.1/lib/rails/engine.rb:526:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-3.12.2/lib/puma/configuration.rb:227:in `call'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-3.12.2/lib/puma/server.rb:674:in `handle_request'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-3.12.2/lib/puma/server.rb:476:in `process_client'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-3.12.2/lib/puma/server.rb:334:in `block in run'
/Users/sslade/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-3.12.2/lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Update:
Disabling actiontext resolves this issue. However, it is not not ideal especially if I decide I want to use it in the future.
config/application.rb
# require 'rails/all'
require 'rails'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_view/railtie'
require 'action_mailer/railtie'
require 'active_job/railtie'
require 'action_cable/engine'
require 'action_mailbox/engine'
# require 'action_text/engine'
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
After disabling ActionText, Rails let me know of some errors in ApplicationController. There was a line where I had =|| instead of||=. After fixing that syntax, my app loaded as expected.
I then added ActionText back in afterwards to see if it would load: it did! So it was in fact a simple syntax mistake in ApplicationController but for some reason I was getting an ActionText error instead the syntax error.
If there is any follow up as to why this issue may have occurred, please update this thread: https://github.com/rails/rails/issues/39130
Related
Disclaimer: I know there are a couple of questions regarding this issue, but I followed all the answers. posted in those questions and I am still getting the error.
I have a rails app setup using Postgres and am trying to switch to mongoid. Here are the steps I took:
drop databases
add 'mongoid', '~> 7.0.5' and delete 'pg' gem
remove all references to active_record and active_storage
remove spring gems (known to cause issues)
update all models to be compatible with mongodb
delete config/database.yml and /db directory
switch devise and database-cleaner to use mongoid
After following all of the above steps, I am still getting the error when starting the server:
Could not load database configuration - No such file - [config/database.yml]
This doesn't make any sense, because rails should not be loading active record at all, and therefore should not be loading the database config file.
I would really appreciate if someone could be debug this issue.
You can view the source code of my app under the branch mongodb
Edit: I disabled bootsnap and devise and got the stack trace down to this: (It looks like active_record is still being loaded)
Puma caught this error: Cannot load database configuration:
Could not load database configuration. No such file - ["config/database.yml"] (RuntimeError)
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/application/configuration.rb:241:in `database_configuration'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/railtie.rb:200:in `block (2 levels) in <class:Railtie>'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/base.rb:27:in `<top (required)>'
/Users/afamily/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
/Users/afamily/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/query_cache.rb:31:in `run'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/execution_wrapper.rb:28:in `before'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:428:in `block in make_lambda'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:604:in `catch'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:604:in `block in default_terminator'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:201:in `block in halting'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `each'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:513:in `invoke_before'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/execution_wrapper.rb:111:in `run!'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/execution_wrapper.rb:73:in `block in run!'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/execution_wrapper.rb:70:in `tap'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.2/lib/active_support/execution_wrapper.rb:70:in `run!'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.2/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.2/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/actionpack-6.0.3.2/lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/webpacker-4.2.2/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/railties-6.0.3.2/lib/rails/engine.rb:527:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/puma-4.3.5/lib/puma/configuration.rb:228:in `call'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/puma-4.3.5/lib/puma/server.rb:713:in `handle_request'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/puma-4.3.5/lib/puma/server.rb:472:in `process_client'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/puma-4.3.5/lib/puma/server.rb:328:in `block in run'
/Users/afamily/.rvm/gems/ruby-2.7.1/gems/puma-4.3.5/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
I believe this is the same issue as https://github.com/rails/spring/issues/601, in your case originating from devise here:
/home/sandbox/agilely/vendor/bundle/ruby/2.7.0/gems/devise-4.7.2/lib/devise/models/confirmable.rb:52:in `block in <module:Confirmable>'
If you remove devise from your application and you are able to load console successfully, I suggest reporting this issue to devise.
Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError)
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actiontext-6.0.1/lib/action_text/engine.rb:43:in `block (2 levels) in <class:Engine>'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `instance_exec'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `catch'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `block in default_terminator'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:202:in `block in halting'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `block in invoke_before'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `each'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `invoke_before'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:134:in `run_callbacks'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:119:in `complete!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:76:in `block in run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `tap'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `run!'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/static.rb:126:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/webpacker-4.2.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/engine.rb:526:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/configuration.rb:228:in `call'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:667:in `handle_request'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:470:in `process_client'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/server.rb:328:in `block in run'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.0/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
Most likely your app is missing ApplicationController class. can you double-check the case please if it's present under app/controllers/application_controller.rb
If you don't find the file straightaway, don't be worried! It may be likely that your app is structured in such a way that does not depend on defining ApplicationController. ActionText has a long-standing issue, due to which you may have difficulty in using it.
You can keep track of this open issue that discusses about using ActionText in projects which do NOT depend on default ApplicationController class: https://github.com/rails/rails/issues/37183
If this is not your case, then you can simply overcome the issue by creating the class in the above mentioned directory.
Enjoy!
I am learning Ruby on Rails with Michael Hartl's book Ruby on Rails™ Tutorial: Learn Web Development with Rails, Fourth Edition. I got the error message when trying the toy_app. Does anyone know what's wrong?
Puma caught this error: Invalid option key: raise_on_unfiltered_parameters= (RuntimeError)
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:59:in `block (3 levels) in <class:Railtie>'
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:54:in `each'
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:54:in `block (2 levels) in <class:Railtie>'
.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:263:in `<class:Base>'
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:164:in `<module:ActionController>'
.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:5:in `<top (required)>'
.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:77:in `ext'
.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:33:in `match?'
.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:130:in `call'
.gem/ruby/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
.gem/ruby/gems/railties-5.0.0/lib/rails/engine.rb:522:in `call'
.gem/ruby/gems/puma-3.4.0/lib/puma/configuration.rb:224:in `call'
.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:569:in `handle_request'
.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:406:in `process_client'
.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:271:in `block in run'
.gem/ruby/gems/puma-3.4.0/lib/puma/thread_pool.rb:114:in `call'
.gem/ruby/gems/puma-3.4.0/lib/puma/thread_pool.rb:114:in `block in spawn_thread'
Update: commenting out raise_on_unfiltered_parameters resolves the issue.
I was having this same issue and thi was how i solved it:
go to the
config/initializers/new_framework_defaults.rb
and comment or delete this line of code:
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
i hope this helps
I am running Ruby on Rails 3.2.2 from 3.1.0. I have the issue
undefined method send_register_email\' for #<Syck::DomainType:0x0000012d2346b8>\n/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/performable_mailer.rb:6:in perform ...
with the DelayedJob gem that many other people have tried to solve: someone made successfully that, others no. I am in the latter category, also if I tried all solutions I've found on the Web.
At this time, in my Gemfile I have:
gem 'rails', '3.2.2'
gem "rake"
...
gem 'delayed_job_active_record'
...
Before upgrading Rails, in my Gemfile I had:
gem 'rails', '~> 3.1.0'
gem "rake"
...
# I also used the following statement by running Rails 3.2.2 but it didn't work.
gem 'delayed_job'
...
In order to send e-mail messages, in my controllers I use code link the following:
::Users::Mailer.delay.send_register_email(#user)
In my APPLICATION_ROOT/app/mailers/users/mailer.rb file I have:
class Users::Mailer < ActionMailer::Base
...
def send_register_email(user)
...
end
end
Before updating to Rails 3.2.2 all was working as well. Now I get the error mentioned above, in the introduction text. How can I try to solve the Delayed Job issue?
I noted that in the database table related to the delayed_job_active_record gem should be a column named 'queue' (see the "Gory Details" section in the official documentation for more information). However, since I was using gem 'delayed_job' it was present in that database table. Can be that the problem?
Another thing I noted is the following (but I think that isn't the problem, for now):
$ rake jobs:work
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /<ABSOLUTE_PATH>/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /<ABSOLUTE_PATH>/Rakefile:7)
[Worker(host:<MY_USER>.local pid:76826)] Starting job worker
The following is what is present in the DelayedJob last_error database table column:
{undefined method `send_register_email' for #<Syck::DomainType:0x0000010228a840>
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/performable_mailer.rb:6:in `perform'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/backend/base.rb:91:in `invoke_job'
/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:162:in `block (2 levels) in run'
/<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:162:in `block in run'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:161:in `run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:218:in `block in reserve_and_run_one_job'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:218:in `reserve_and_run_one_job'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:146:in `block in work_off'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:145:in `times'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:145:in `work_off'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:117:in `block (4 levels) in start'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:116:in `block (3 levels) in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:113:in `block (2 levels) in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:112:in `loop'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:112:in `block in start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/plugins/clear_locks.rb:7:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:60:in `block in initialize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:78:in `block in add'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:65:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/worker.rb:111:in `start'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/<ABSOLUTE_PATH>//.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/<ABSOLUTE_PATH>//.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
If you are using bundler try prefixing the script or rake task with "bundle exec" e.g.
bundle exec script/delayed_job -n 2 start
It did the trick for us.
We managed to solve Syck / Psych weirdness in our app by ensuring that setting the YAML parser to Syck was the absolute first thing done when initializing. The reason you can sometimes run into issues is that DelayedJob initializes differently depending on which YAML parser you're using, and if the parser changes during initialization, DelayedJob will probably get it wrong.
Add this to the very top of boot.rb, and see if it helps:
require 'yaml'
YAML::ENGINE.yamler = 'syck'
As part of my rails project, we are going to use a daemon as a message queue listener to execute commands coming from a Rails RESTful webservice front end.
For ease of prototyping, we are using the Daemons gem to create a very simple daemon. Right now, it's super simple. Here is the code:
require 'rubygems'
require 'daemons'
require File.expand_path('../../config/environment', __FILE__)
Daemons.run_proc('aeon_server') do
loop do
empires = Empire.all
sleep(5)
end
end
Basically, it requires the things for daemons, then requires my Ruby environment, then launches in to the daemon. The daemon simply attempts to query everything from the Empires table. Then it sleeps and does it again.
When it goes to execute 'all', I get the following exception:
C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:109:in `write': closed stream (IOError)
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:109:in `block in flush'
from <internal:prelude>:10:in `synchronize'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:102:in `flush'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:126:in `auto_flush'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:67:in `add'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/buffered_logger.rb:78:in `debug'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract_adapter.rb:206:in `rescue in log'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract_adapter.rb:199:in `log'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/sqlite_adapter.rb:284:in `select'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/query_cache.rb:56:in `select_all'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/base.rb:468:in `find_by_sql'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/relation.rb:64:in `to_a'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/relation/finder_methods.rb:143:in `all'
from C:in `all'
from script/aeon_server_control.rb:9:in `block (2 levels) in <main>'
from script/aeon_server_control.rb:7:in `loop'
from script/aeon_server_control.rb:7:in `block in <main>'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `call'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `block in start_proc'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:260:in `call'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:260:in `start_proc'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:293:in `start'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/controller.rb:73:in `run'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:195:in `block in run_proc'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `call'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `catch_exceptions'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:194:in `run_proc'
from script/aeon_server_control.rb:6:in `<main>'
Any idea why ActiveSupport is throwing this exception? Are there additional steps I need to "bootstrap" my rails environment in to the daemon, beyond just requiring the environment?
There're some intricacies with regard to file descriptors when the process is forked/spawned/whatever-it-is-called-on-windows.
Try to reinstantiate a logger after you do Daemons.run_proc('aeon_server') with Rails.logger = ActiveSupport::BufferedLogger.new('/path/to/log')