Rake test : NoMethodError: undefined method `each' for nil:NilClass - ruby-on-rails

I am constantly getting this error and unable to understand the issue. As the whole stack does not have any of my code. The only hint i have is that this started happening after a git merge.
Here is the error stack please let me know if you have any clue. Thanks
NoMethodError: undefined method `each' for nil:NilClass
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/ac
tion_controller/test_case.rb:58:in `teardown_subscriptions'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:432:in `block in make_lambda'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:263:in `call'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:263:in `block in simple'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:506:in `call'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:506:in `block in call'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:506:in `each'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:506:in `call'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:92:in `_run_callbacks'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:776:in `_run_teardown_callbacks'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/callbacks.rb:81:in `run_callbacks'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib
/active_support/testing/setup_and_teardown.rb:45:in `after_teardown'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.1/lib/
active_record/fixtures.rb:829:in `after_teardown'

One of the model validation was failing while loading the fixtures.This validation error was not thrown and the test cases failed with the message 'NoMethodError: undefined method `each' for nil:NilClass'

Related

(Ferrum::Browser) Simple browser.evaluate issue

I am running this simple ruby code block with Ferrum gem.
require "ferrum"
browser = Ferrum::Browser.new
browser.go_to("http://grmdaily.com/")
browser.evaluate("pbjs.getConfig()") #throws error stack below
and getting this error:
2022-08-22T15:47:44.660Z pid=86509 tid=3xh WARN: NoMethodError: undefined method `[]' for nil:NilClass
2022-08-22T15:47:44.660Z pid=86509 tid=3xh WARN: /usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:193:in `block in handle_response'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:220:in `block in reduce_props'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:218:in `each'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:218:in `reduce'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:218:in `reduce_props'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:192:in `handle_response'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:144:in `block in call'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum.rb:145:in `with_attempts'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:124:in `call'
/usr/share/rvm/gems/ruby-2.7.2/gems/ferrum-0.11/lib/ferrum/frame/runtime.rb:50:in `evaluate'
/usr/share/rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/forwardable.rb:235:in `evaluate'
/usr/share/rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/forwardable.rb:235:in `evaluate'
The line 'pbjs.getConfig()' returns object on real window.
What I am doing wrong or missing?

Rails 6, #unbound_templates is nil in actionview/lib/action_view/template/resolver.rb

Upgrading from Rails 5.2.3 to 6.0.0 or 6.0.1, with Ruby 2.6.3, after bundling succeeds, the rails app:update command has been carefully run, and webpacker updated, a request to any page that requires no authentication gives:
Puma caught this error: undefined method `clear' for nil:NilClass (NoMethodError)
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:181:in `clear_cache'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:16:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:16:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/lookup_context.rb:79:in `block in clear'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/lookup_context.rb:78:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/lookup_context.rb:78:in `clear'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:40:in `clear_cache'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:30:in `block (2 levels) in clear_cache_if_necessary'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/file_update_checker.rb:83:in `execute'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:32:in `block in clear_cache_if_necessary'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:23:in `synchronize'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:23:in `clear_cache_if_necessary'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/cache_expiry.rb:11:in `before'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `catch'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:202:in `block in halting'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:514:in `invoke_before'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:111:in `run!'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:73:in `block in run!'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `tap'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb:70:in `run!'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/webpacker-4.2.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/engine.rb:526:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/deflater.rb:34:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/configuration.rb:228:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:667:in `handle_request'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:470:in `process_client'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:328:in `block in run'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
A second request to the same page gives:
Error during failsafe response: undefined method `compute_if_absent' for nil:NilClass
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:199:in `block in query'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:196:in `map'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:196:in `query'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:189:in `_find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:121:in `block in find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:156:in `block in cached'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:66:in `cache'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:155:in `cached'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/template/resolver.rb:120:in `find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:77:in `block (2 levels) in _find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:76:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:76:in `block in _find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:75:in `each'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:75:in `_find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:55:in `find_all'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/path_set.rb:48:in `find'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/lookup_context.rb:129:in `find'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/renderer/template_renderer.rb:47:in `determine_template'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/renderer/template_renderer.rb:9:in `render'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/rendering.rb:118:in `block in _render_template'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/base.rb:304:in `in_rendering_context'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/rendering.rb:117:in `_render_template'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/rendering.rb:103:in `render_to_body'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/abstract_controller/rendering.rb:25:in `render'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/rendering.rb:36:in `render'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/Users/Emma/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:85:in `cleanup_view_runtime'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.1/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
/Users/Emma/rails/consonance/app/controllers/exceptions_controller.rb:20:in `block (2 levels) in show'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
/Users/Emma/rails/consonance/app/controllers/exceptions_controller.rb:14:in `show'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/abstract_controller/base.rb:196:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/notifications.rb:180:in `block in instrument'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/notifications.rb:180:in `instrument'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/abstract_controller/base.rb:136:in `process'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.1/lib/action_view/rendering.rb:39:in `process'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal.rb:191:in `dispatch'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_controller/metal.rb:236:in `block in action'
/Users/Emma/rails/consonance/config/application.rb:172:in `block in <class:Application>'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/show_exceptions.rb:51:in `render_exception'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/show_exceptions.rb:36:in `rescue in call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/rack/logger.rb:38:in `call_app'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/rack/logger.rb:26:in `block in call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb:80:in `block in tagged'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb:28:in `tagged'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb:80:in `tagged'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/rack/logger.rb:26:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/request_store-1.4.1/lib/request_store/middleware.rb:19:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/skylight-core-4.0.2/lib/skylight/core/probes/action_dispatch/request_id.rb:12:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/method_override.rb:22:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/runtime.rb:22:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/webpacker-4.2.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/engine.rb:526:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/deflater.rb:34:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/configuration.rb:228:in `call'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:667:in `handle_request'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:470:in `process_client'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/server.rb:328:in `block in run'
/Users/Emma/.rvm/gems/ruby-2.6.3/gems/puma-4.3.0/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
This means that the #unbound_templates variable introduced here is nil. On a Rails console, Concurrent::Map.new works fine.
How can this instance variable, that gets set in the initializer, be nil?
I have the exact same error and I have had no progress debugging it thus far. My suspicion is that it is caused by a gem but I just don't know yet.
#snowangel if you want to compare Gemfiles I've posted mine here: https://gist.github.com/biscuitvile/7bf0d4423ce0b2aa79e0ccc08bff4295
NOTE: I got the same error on the second request
undefined method `compute_if_absent' for nil:NilClass
TLDR;
Configure database's prepared_statements only to true or false
EXPLANATION
In my case, I erroneously configured prepared_statements to nil.
In this line on ActiveRecord, it calls #find_by_statement_cache then calls compute_if_absent,
def cached_find_by_statement(key, &block)
cache = #find_by_statement_cache[connection.prepared_statements]
# THIS LINE BELOW
cache.compute_if_absent(key) { StatementCache.create(connection, &block) }
end
where it has the following value:
#find_by_statement_cache = { true => Concurrent::Map.new, false => Concurrent::Map.new }
And since I've configured it to nil, it renders an undefined method compute_if_absent error.

Delayed Jobs failing in production on the server

All my delayed jobs are failing for no apparent reason in production on the server. I tried restarting, removing all previous jobs and again starting the job worker, but nothing worked.
Suspecting it must be a capistrano issue, I manually ran rake jobs:work via ssh on the server but I got the same error:
ubuntu#ip-172-31-35-0:~/apps/instano-api/current$ rake jobs:work
[Worker(host:ip-172-31-35-0 pid:22174)] Starting job worker
[Worker(host:ip-172-31-35-0 pid:22174)] Job InstanoMailer.new_quote (id=73) RUNNING
[Worker(host:ip-172-31-35-0 pid:22174)] Job InstanoMailer.new_quote (id=73) FAILED (3 prior attempts) with NameError: undefined method `error' for class `Class'
I use ExceptionNotifier gem, from which I got the following stack trace (but none of the lines are from my application code):
A NameError occurred in background at 2014-12-17 02:43:21 +0530 :
undefined method `error' for class `Class'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
-------------------------------
Backtrace:
-------------------------------
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:113:in `hook'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:97:in `rescue in block in invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:101:in `block in invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:91:in `invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:199:in `block (2 levels) in run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:82:in `block in timeout'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:70:in `catch'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:70:in `timeout'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:199:in `block in run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:198:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:275:in `block in reserve_and_run_one_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:275:in `reserve_and_run_one_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:182:in `block in work_off'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:181:in `times'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:181:in `work_off'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:146:in `block (4 levels) in start'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:145:in `block (3 levels) in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:144:in `block (2 levels) in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:143:in `loop'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:143:in `block in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/plugins/clear_locks.rb:7:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `block in add'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:142:in `start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:124:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:112:in `block in run_process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `block in start_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call_as_daemon'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:259:in `start_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:296:in `start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/controller.rb:70:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons.rb:197:in `block in run_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons.rb:196:in `run_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:110:in `run_process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:91:in `block in daemonize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:89:in `times'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:89:in `daemonize'
bin/delayed_job:5:in `<main>'
-------------------------------
Data:
-------------------------------
* data: {}
This seems to be a feature limitation in Delayed Job. Errors are not reported properly. The trace and error message is completely incorrect.
I debugged mine by looking at the rails production log. It was hard to find because there was no error while adding the task to delayed job i.e. I was getting a [INFO] tag instead of [ERROR] in logs.
I hope someone points out how to get proper and meaningful stack traces in case of failed Delayed Jobs.
As a footnote, my error was a real specific (and lame) one. My smtp settings in /config/environments/production.rb was incompatible my mailer so I was getting this error only in production.

How to debug a "TypeError: can't convert nil into String" with the traceback of rake tests?

There are a lot of rake tests failing in a ruby on rails project [1], all with same error (can't convert nil into String), and I don't have any idea why is this happening neither how I should debug it.
For example, this is the first tracebak of rake test (I have attached full rake test traceback at the end of the message [2]).
Error:
test_update(Admin::BazarDistrictsControllerTest):
TypeError: can't convert nil into String
/usr/lib/ruby/1.9.1/psych.rb:154:in `parse'
/usr/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
/usr/lib/ruby/1.9.1/psych.rb:125:in `parse'
/usr/lib/ruby/1.9.1/psych.rb:112:in `load'
/srv/www/gamersmafia/current/app/models/users_skill.rb:178:in `role_data_yaml'
/srv/www/gamersmafia/current/app/models/alert.rb:200:in `block in update_pending_alerts'
/srv/www/gamersmafia/current/app/models/alert.rb:198:in `each'
/srv/www/gamersmafia/current/app/models/alert.rb:198:in `update_pending_alerts'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/performable_method.rb:26:in `perform'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:37:in `block in enqueue'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `tap'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `enqueue'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/message_sending.rb:13:in `method_missing'
/srv/www/gamersmafia/current/app/models/alert.rb:182:in `block in update_pending_alerts'
/srv/www/gamersmafia/current/app/models/alert.rb:180:in `each'
/srv/www/gamersmafia/current/app/models/alert.rb:180:in `update_pending_alerts'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:460:in `_run__1673722312823048322__save__808729243992924512__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/callbacks.rb:264:in `create_or_update'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:84:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/validations.rb:50:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:208:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/deadlock_retry-1.2.0/lib/deadlock_retry.rb:31:in `transaction_with_deadlock_handling'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block in save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:258:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:45:in `create'
/srv/www/gamersmafia/current/app/models/bazar_district.rb:158:in `update_single_person_staff'
/srv/www/gamersmafia/current/app/models/bazar_district.rb:83:in `update_don'
/srv/www/gamersmafia/current/app/controllers/admin/bazar_districts_controller.rb:43:in `update'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:167:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:503:in `block in _run__1141341086633682237__process_action__2809844012775858444__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_5310'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:233:in `block (2 levels) in gm_process'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `catch'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `block in gm_process'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:231:in `gm_process'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_5310'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:469:in `_run__1141341086633682237__process_action__2809844012775858444__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `instrument'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:121:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:45:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:473:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:49:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:395:in `post'
/srv/www/gamersmafia/current/test/functional/admin/bazar_districts_controller_test.rb:42:in `block in <class:BazarDistrictsControllerTest>'
And I have more than 200 test with errors of a total of 1448 tests.
The question is, from where must I start to debug it? Why I'm getting same error in +90% of tests?
[1] https://github.com/gamersmafia/gamersmafia
[2] https://dl.dropbox.com/u/42306424/salida_rake.txt
In case of debugging. I reccomend to use gem 'pry-rails'.
Just bundle this gem and add 'binding.pry' to failing test. It will open console with all variables from your test, so you can manually check it. I hope it helps you to find out what's wrong.
It's might be one of the problems of Cucumber version.
You can fix this by upgrading cucumber-rails to a recent version. Just edit your Gemfile to show this:
gem 'cucumber-rails', '>= 1.1.1' or newer version
its solved my error when i got the same.
In your case, its pointed delayed_job gem
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
and Try!!!!

mini_magick wrong number of arguments (0 for 1) on .resize

I'm not sure what's going on here.
Using MiniMagick 3.3, everything was working fine until I tried to resize.
This line is causing me to get a wrong number of arguments error:
image_file.resize "#{style.width}x#{style.height}"
Which seems like it should work fine according to the docs.
Here's the trace:
wrong number of arguments (0 for 1)
RAILS_ROOT: /tmn_core_cms
Application Trace | Framework Trace | Full Trace
/tmn_core_cms/vendor/gems/mini_magick-3.3/lib/mini_magick.rb:323:in `combine_options'
/tmn_core_cms/vendor/gems/mini_magick-3.3/lib/mini_magick.rb:323:in `method_missing'
/tmn_core_cms/lib/imagemodule.rb:15:in `apply_styles'
/tmn_core_cms/lib/imagemodule.rb:11:in `apply_styles'
/tmn_core_cms/app/models/asset.rb:143:in `site_image_render'
/tmn_core_cms/app/controllers/articles_controller.rb:66:in `update'
/tmn_core_cms/app/controllers/articles_controller.rb:65:in `update'
image_file = MiniMagick::Image.open("#{RAILS_ROOT}/public/images/i/Standard/#{baseimage.id}/original/#{baseimage.image_file_name}")
The image_file was returning the correct object ( I was testing everything as I added each step, it all worked up until I resized)
The top section says ArgumentError in ArticlesController#update
Here's the full trace:
ArgumentError in ArticlesController#update
wrong number of arguments (0 for 1)
RAILS_ROOT: /tmn_core_cms
Application Trace | Framework Trace | Full Trace
/tmn_core_cms/vendor/gems/mini_magick-3.3/lib/mini_magick.rb:323:in `combine_options'
/tmn_core_cms/vendor/gems/mini_magick-3.3/lib/mini_magick.rb:323:in `method_missing'
/tmn_core_cms/lib/imagemodule.rb:15:in `apply_styles'
/tmn_core_cms/vendor/gems/will_paginate-2.3.15/lib/will_paginate/finder.rb:168:in `method_missing'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing_without_paginate'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `each'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing_without_paginate'
/tmn_core_cms/vendor/gems/will_paginate-2.3.15/lib/will_paginate/finder.rb:168:in `method_missing'
/tmn_core_cms/vendor/gems/thinking-sphinx-1.3.20/lib/thinking_sphinx/active_record/has_many_association.rb:19:in `method_missing'
/tmn_core_cms/lib/imagemodule.rb:11:in `apply_styles'
/tmn_core_cms/app/models/asset.rb:143:in `site_image_render'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/callbacks.rb:251:in `create_or_update'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/base.rb:2577:in `save_without_validation'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/validations.rb:1090:in `save_without_dirty'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/dirty.rb:79:in `save_without_transactions'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/autosave_association.rb:356:in `save_has_one_association'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/autosave_association.rb:182:in `autosave_associated_records_for_asset'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/callbacks.rb:251:in `create_or_update'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/base.rb:2577:in `save_without_validation'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/validations.rb:1090:in `save_without_dirty'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/dirty.rb:79:in `save_without_transactions'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/base.rb:2672:in `update_attributes_inside_transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/base.rb:2667:in `update_attributes'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/tmn_core_cms/app/controllers/articles_controller.rb:66:in `update'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `respond_to'
/tmn_core_cms/app/controllers/articles_controller.rb:65:in `update'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/tmn_core_cms/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/tmn_core_cms/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/tmn_core_cms/vendor/gems/rack-raw-upload-1.0.9/lib/rack/raw_upload.rb:17:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:99:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/tmn_core_cms/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/tmn_core_cms/vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'
/tmn_core_cms/vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in `process'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/tmn_core_cms/vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in `run'
/tmn_core_cms/vendor/rails/railties/lib/commands/server.rb:111
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
Request
Parameters:
{"article"=>{"asset_attributes"=>{"publish_date(1i)"=>"2011",
"canonical"=>"",
"name"=>"Test",
"content_image_attributes"=>{"image_id"=>"1",
"id"=>"2"},
"publish_date(2i)"=>"9",
"by_line"=>"",
"publish_date(3i)"=>"28",
"guid"=>"",
"display_authorbiography"=>"1",
"content_section_attributes"=>{"id"=>"2",
"primary_section"=>"1"},
"publish_date(4i)"=>"06",
"publish_date(5i)"=>"00",
"id"=>"2",
"public_keywords_string"=>"",
"tagline"=>"",
"keywords_string"=>"",
"display_adsense"=>"1",
"author_id"=>"1",
"series_id"=>"",
"partner_id"=>"",
"short_desc"=>"Test"},
"content_text"=>"<p>\r\n\tTest</p>\r\n"},
"articlems2side__sx"=>"1",
"commit"=>"Update",
"_method"=>"put",
"authenticity_token"=>"R57YKHe3VD38JbpENgZf4ruSAffkyuVp18LY1qOfE/U=",
"id"=>"2-test",
"site"=>{"id"=>""},
"secondary_site"=>{"id"=>""}}
Show session dump
Response
Headers:
{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}
Try replacing the string interpolation with a value and test that, maybe something is going wrong there.
image_file.resize "250x250"
If that works then you need to look at your definition for style since it may not be defined properly or you may be calling a method by an incorrect name.
Edit 0:
Try opening a console for your application and running some example code for MiniMagick just so we can make sure its working:
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "5x5"
If that works in your applications console then the problem exists somewhere besides the installation of the plugin.
Edit 1:
Ok well so its the installation method that's giving you trouble. Using bundler you can install dependencies inside the vendor directory which would give you all the same behaviour of having them installed on the system. Try running bundle install --path vendor/bundle See the docs here.

Resources