I'm attempting to add a scope to the ActiveAdmin routes so that I can include the '/:brand' within the URL. SO instead of localhost:3000/admin/dashboard it would be localhost:3000/bg/admin/dashboard, with the bg being the brand.
I have my routes.rb setup like this:
Rails.application.routes.draw do
scope '/:brand', brand: /bg|gwt|acf/ do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
end
end
The route for logging in http://localhost:3000/bg/admin/login works perfectly fine. But once logged in I'm getting the below error for any ActiveAdmin resource.
ActionController::UrlGenerationError (No route matches {:action=>"index", :controller=>"admin/dashboard"} missing required keys: [:brand]):
actionpack (5.0.0.1) lib/action_dispatch/journey/formatter.rb:50:in `generate'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:629:in `generate'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:660:in `generate'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:707:in `url_for'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:236:in `call'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:295:in `block (2 levels) in define_url_helper'
/Users/computer/.rvm/gems/ruby-2.3.1/bundler/gems/activeadmin-f8926831429f/lib/active_admin/devise.rb:40:in `root_path'
devise (4.2.0) lib/devise/controllers/helpers.rb:178:in `signed_in_root_path'
devise (4.2.0) lib/devise/controllers/helpers.rb:214:in `after_sign_in_path_for'
devise (4.2.0) app/controllers/devise_controller.rb:114:in `require_no_authentication'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:382:in `block in make_lambda'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:12:in `block (2 levels) in <module:Callbacks>'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:454:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:454:in `each'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:454:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/rack/developer_mode.rb:48:in `traced_call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
web-console (3.3.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.3.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack-timeout (0.4.2) lib/rack/timeout/core.rb:122:in `block in call'
rack-timeout (0.4.2) lib/rack/timeout/support/timeout.rb:19:in `timeout'
rack-timeout (0.4.2) lib/rack/timeout/core.rb:121:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
newrelic_rpm (3.15.2.317) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
puma (3.6.0) lib/puma/configuration.rb:225:in `call'
puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
puma (3.6.0) lib/puma/server.rb:415:in `process_client'
puma (3.6.0) lib/puma/server.rb:275:in `block in run'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Rendering /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (4.3ms)
Rendering /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.7ms)
Rendering /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered /Users/computer/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (103.9ms)
source=rack-timeout id=da53bfbfe078024cf2939732b0756051 timeout=3100000ms service=578ms state=completed
Anyone have any idea why this is happening or a way to get around it? Any help is greatly appreciated. Thanks!
Found the issue. Feel a bit silly about this, but I was using a forked repo of the original ActiveAdmin. When I switched over to use the latest from the original ActiveAdmin everything works exactly like I expected it to.
Just in case someone runs into the same issue, I was using https://github.com/dtaniwaki/active_admin, which hasnt' been updated in over 4 years.
Your error is telling you that no route exists for the url you are trying to visit.
No route matches {:action=>"index", :controller=>"admin/dashboard"} missing required keys: [:brand]
Specifically, you're missing the :brand.
Where are you redirecting to after successful sign in?
It should look something like admin_root_path(brand: 'bg'). And every path helper you invoke will need to specify that :brand param.
This error sometimes indicates there is some error in some path definition,
I was defining the wrong path for the logout path for the admin session and thus got this error.
Related
Rails keeps losing reference one of my controllers. If I restart the server, it will return, then after a bit of navigating, I'll get the uninitalized constant Controller error again...
I've never seen this error before.
Here's a dump of the rake:
admin_teams GET /admin/teams(.:format) admin/teams#index
POST /admin/teams(.:format) admin/teams#create
new_admin_team GET /admin/teams/new(.:format) admin/teams#new
edit_admin_team GET /admin/teams/:id/edit(.:format) admin/teams#edit
admin_team GET /admin/teams/:id(.:format) admin/teams#show
PATCH /admin/teams/:id(.:format) admin/teams#update
PUT /admin/teams/:id(.:format) admin/teams#update
DELETE /admin/teams/:id(.:format) admin/teams#destroy
Here's the routes:
namespace :admin do
resources :team_members
resources :organizations
resources :users
resources :teams
end
the controller:
module Admin
class TeamsController < Admin::AdminController
def index
#teams = Team.all
end
end
end
the views:
** Update **
Here's the log trace:
ActionController::RoutingError - uninitialized constant Admin::TeamsController:
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:270:in `const_get'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:270:in `block in constantize'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `each'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `inject'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
actionpack (5.0.0.1) lib/action_dispatch/http/request.rb:93:in `controller_class'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
airbrake (6.0.0) lib/airbrake/rack/middleware.rb:52:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
I randomly run into errors where my framework complains about a missing class because of a bad namespace.
For some reasons Rails will try to look for class name namespaced from a different gem :
Suppose I have a ::ProfilesController in my root namespace, I sometimes get errors of
uninitialized constant Mongoid::Token::Collisions::ProfilesController
Where Mongoid::Token::Collisions (an example) is a module from a different gem used in models. I have several profiles controller declared the following way
class ::ProfilesController < Devise::RegistrationsController
class Registrations::ProfilesController < Devise::RegistrationsController
class Foo::ProfilesController < FooController
class Bar::ProfilesController < BarController
class Baz::Foo::ProfilesController < BazController
I don't understand how it's even possible to resolve ProfileController with the Mongoid::Token::Collisions namespace since I never write in my code ProfilesController as is without any namespace or the :: prefix
I actually had similar errors with different components. Usually the problem would go away when restarting the server. I'm wondering what may cause this behavior, which became more frequent. I'm not sure providing code would be of any help, the stack trace doesn't even start from my application code. Any idea where this may come from ?
ActionController::RoutingError (uninitialized constant Mongoid::Token::Collisions::ProfilesController):
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:283:in `const_get'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:283:in `block in constantize'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `each'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `inject'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
actionpack (5.0.0.1) lib/action_dispatch/http/request.rb:93:in `controller_class'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
rack-attack (5.0.1) lib/rack/attack.rb:147:in `call'
omniauth (1.3.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.3.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.3.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.3.2) lib/omniauth/strategy.rb:164:in `call'
rack-tracker (1.1.0) lib/rack/tracker.rb:34:in `call'
rack-utm (0.0.2) lib/rack-utm.rb:59:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.3.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.3.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
ahoy_matey (1.5.2) lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
request_store (1.3.1) lib/request_store/middleware.rb:9:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.0) lib/puma/configuration.rb:225:in `call'
puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
puma (3.6.0) lib/puma/server.rb:415:in `process_client'
puma (3.6.0) lib/puma/server.rb:275:in `block in run'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
I am trying to send devise mails by doing the following
Model
class Member < ActiveRecord::Base
devise :database_authenticatable, :async, :confirmable # etc ...
end
config/initializers/devise.rb:
# Configure the class responsible to send e-mails.
config.mailer = "Devise::Async::Proxy"
config/initializers/devise_async.rb
Devise::Async.setup do |config|
config.enabled = true
config.backend = :sidekiq
# config.priority = 10
config.queue = :default
end
When i try to sign up and as i have confirmable enabled i get the following error
ArgumentError - wrong number of arguments (3 for 1..2):
() Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/devise-342304375946/lib/devise/models/confirmable.rb:115:in `send_confirmation_instructions'
() Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/devise-342304375946/lib/devise/models/confirmable.rb:171:in `send_on_create_confirmation_instructions'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:506:in `block in call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:506:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
activerecord (4.2.5.2) lib/active_record/callbacks.rb:306:in `_create_record'
activerecord (4.2.5.2) lib/active_record/timestamp.rb:57:in `_create_record'
activerecord (4.2.5.2) lib/active_record/persistence.rb:504:in `create_or_update'
activerecord (4.2.5.2) lib/active_record/callbacks.rb:302:in `block in create_or_update'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
activerecord (4.2.5.2) lib/active_record/callbacks.rb:302:in `create_or_update'
activerecord (4.2.5.2) lib/active_record/persistence.rb:120:in `save'
activerecord (4.2.5.2) lib/active_record/validations.rb:37:in `save'
activerecord (4.2.5.2) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (4.2.5.2) lib/active_record/transactions.rb:286:in `block (2 levels) in save'
activerecord (4.2.5.2) lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
activerecord (4.2.5.2) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
activerecord (4.2.5.2) lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
activerecord (4.2.5.2) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
activerecord (4.2.5.2) lib/active_record/transactions.rb:220:in `transaction'
activerecord (4.2.5.2) lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
activerecord (4.2.5.2) lib/active_record/transactions.rb:286:in `block in save'
activerecord (4.2.5.2) lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
activerecord (4.2.5.2) lib/active_record/transactions.rb:285:in `save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:26:in `block in save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/transaction.rb:848:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent.rb:572:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:25:in `save'
() Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/devise-342304375946/app/controllers/devise/registrations_controller.rb:17:in `create'
actionpack (4.2.5.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.5.2) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.5.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5.2) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.5.2) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5.2) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.5.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.5.2) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.5.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.5.2) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.5.2) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.5.2) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.5.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.5.2) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.5.2) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.5.2) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.5.2) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb:815:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
bullet (5.0.0) lib/bullet/rack.rb:10:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
versionist (1.4.1) lib/versionist/middleware.rb:39:in `_call'
versionist (1.4.1) lib/versionist/middleware.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/flash.rb:260:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/cookies.rb:560:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (4.2.5.2) lib/active_record/query_cache.rb:36:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (4.2.5.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (4.2.5.2) lib/active_record/migration.rb:377:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/reloader.rb:73:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack-contrib (1.4.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.4.0) lib/meta_request/middlewares/headers.rb:16:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (4.2.5.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5.2) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5.2) lib/rails/rack/logger.rb:20:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activesupport (4.2.5.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.5.2) lib/action_dispatch/middleware/static.rb:116:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (4.2.5.2) lib/rails/engine.rb:518:in `call'
railties (4.2.5.2) lib/rails/application.rb:165:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/harshamv/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Remove config.enabled = true and try again.
I'm using the devise view to reset a User's password.
I'm sending the reset_password_token and the new passwords, and i'm getting this error.
Any ideas?
I'd be happy to any add any necessary details. I'm using rails 3.2 with devise '3.5.6'
NoMethodError (undefined method `to_datetime' for nil:NilClass):
activesupport (3.2.14) lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
activesupport (3.2.14) lib/active_support/core_ext/time/calculations.rb:359:in `compare_with_coercion'
activesupport (3.2.14) lib/active_support/time_with_zone.rb:190:in `<=>'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `=='
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `!='
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `_field_changed?'
activerecord (3.2.14) lib/active_record/attribute_methods/serialization.rb:97:in `_field_changed?'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:63:in `write_attribute'
activerecord (3.2.14) lib/active_record/attribute_methods/time_zone_conversion.rb:47:in `reset_password_sent_at='
devise (3.5.6) lib/devise/models/recoverable.rb:94:in `clear_reset_password_token'
devise (3.5.6) lib/devise/models/recoverable.rb:32:in `block (2 levels) in <module:Recoverable>'
activesupport (3.2.14) lib/active_support/callbacks.rb:407:in `_run__312818332643827378__update__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_update_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.14) lib/active_record/callbacks.rb:272:in `update'
activerecord (3.2.14) lib/active_record/persistence.rb:348:in `create_or_update'
activerecord (3.2.14) lib/active_record/callbacks.rb:264:in `block in create_or_update'
activesupport (3.2.14) lib/active_support/callbacks.rb:414:in `_run__312818332643827378__save__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.14) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.2.14) lib/active_record/persistence.rb:84:in `save'
activerecord (3.2.14) lib/active_record/validations.rb:50:in `save'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.2.14) lib/active_record/transactions.rb:259:in `block (2 levels) in save'
activerecord (3.2.14) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/transactions.rb:259:in `block in save'
activerecord (3.2.14) lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
activerecord (3.2.14) lib/active_record/transactions.rb:258:in `save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:26:in `block in save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/transaction.rb:848:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent.rb:572:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:25:in `save'
devise (3.5.6) lib/devise/models/recoverable.rb:48:in `reset_password'
devise (3.5.6) lib/devise/models/recoverable.rb:141:in `reset_password_by_token'
devise (3.5.6) app/controllers/devise/passwords_controller.rb:32:in `update'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.14) lib/active_support/callbacks.rb:447:in `_run__1749634817633484351__process_action__1911466050157971041__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:30:in `block in process_action'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:362:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:25:in `process_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/mapper.rb:43:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/developer_mode.rb:48:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/etag.rb:23:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/conditionalget.rb:35:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__349007920982004187__call__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/reloader.rb:65:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/methodoverride.rb:21:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/runtime.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/lock.rb:15:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/static.rb:63:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (3.2.14) lib/rails/engine.rb:484:in `call'
railties (3.2.14) lib/rails/application.rb:231:in `call'
railties (3.2.14) lib/rails/railtie/configurable.rb:30:in `method_missing'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/content_length.rb:14:in `call'
railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.7) lib/rack/handler/webrick.rb:59:in `service'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (50.4ms)
^[[1;2D
Ok, so apparently it was something to do either with:
I was using letter_opener, so password reset email wasn't actually being sent
Time wan't set correctly on my dev machine
I am finding a similar issue, where my "RAILS_ENV=development bundle exec rake db:drop db:create db:migrate db:seed" command works will with ruby 2.2.3p173, but with ruby 2.3.0p0, it throws the following error:
rake aborted!
NoMethodError: undefined method `to_datetime' for nil:NilClass
.../.rvm/gems/ruby-2.3.0#atlantis/gems/activesupport-3.2.17/lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
I've got a Rails app that has been live for over a year with no issues, running on a custom Ubuntu/Nginx/Puma setup.
Because of various issues with the hosting company, I moved the app over to EC2 this weekend - using ElasticBeanstalk on their Nginx/Puma/Ruby2.2 stack.
Everything is working fine - apart from file uploads.
The app itself uses the Paperclip gem for handling attachments - the actual files are only held momentarily in Paperclip, before being uploaded to a file-server controlled by my client (the very first version used S3 for storage, but now it uploads, attaches the "Job-Sheet" to the Job and then immediately uploads the "Job-Sheet" to the file-server).
As I say, this was all working fine on my old server. But now, on EC2, I'm getting a Encoding::UndefinedConversionError ("\xC3" from ASCII-8BIT to UTF-8) error.
The job sheet itself can be an Excel file or a CSV. It is defined as follows:
class Job < ActiveRecord::Base
...
has_attached_file :job_sheet
validates_attachment_file_name :job_sheet, matches: [/csv\Z/, /xls\Z/, /xlsx\Z/]
validates_attachment_presence :job_sheet
...
end
The controller looks like this:
class JobsController < ApplicationController
...
def create
#job = services['creates_job'].create_job job_params, session: current_session
redirect_to jobs_path
rescue ActiveRecord::RecordInvalid
...
end
...
end
The jobs_params does the StrongParams thing of permitting the parameters as required.
And the CreatesJob service object looks like:
def create_job params, session: nil
...
job = services['jobs'].create! params.merge(code: code)
...
end
So apart from the fact that the actual logic is in a separate "CreatesJob" class, there's nothing unusual going on - pretty much a standard Rails/Paperclip upload situation.
However, some uploads are failing, with the following in the production log:
I, [2016-03-22T10:12:58.701172 #23116] INFO -- : Started POST "/jobs" for 80.0.249.70 at 2016-03-22 10:12:58 +0000
F, [2016-03-22T10:12:58.706190 #23116] FATAL -- : Encoding::UndefinedConversionError ("\xC3" from ASCII-8BIT to UTF-8):
actionpack (4.2.0) lib/action_dispatch/http/upload.rb:31:in `encode'
actionpack (4.2.0) lib/action_dispatch/http/upload.rb:31:in `initialize'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:51:in `new'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:51:in `normalize_encode_params'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:57:in `block in normalize_encode_params'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each_with_object'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `normalize_encode_params'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:57:in `block in normalize_encode_params'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `each_with_object'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:53:in `normalize_encode_params'
actionpack (4.2.0) lib/action_dispatch/http/request.rb:308:in `POST'
actionpack (4.2.0) lib/action_dispatch/http/parameters.rb:14:in `parameters'
actionpack (4.2.0) lib/action_dispatch/http/filter_parameters.rb:37:in `filtered_parameters'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:22:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal.rb:236:in `block in action'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:42:in `serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/rack/browser_monitoring.rb:23:in `traced_call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/etag.rb:24:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/conditionalget.rb:38:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/head.rb:13:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/runtime.rb:18:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.6.1) lib/rack/sendfile.rb:113:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (4.2.0) lib/rails/engine.rb:518:in `call'
railties (4.2.0) lib/rails/application.rb:164:in `call'
newrelic_rpm (3.11.1.284) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
puma (2.11.0) lib/puma/configuration.rb:82:in `call'
puma (2.11.0) lib/puma/server.rb:507:in `handle_request'
puma (2.11.0) lib/puma/server.rb:375:in `process_client'
puma (2.11.0) lib/puma/server.rb:262:in `block in run'
puma (2.11.0) lib/puma/thread_pool.rb:104:in `call'
puma (2.11.0) lib/puma/thread_pool.rb:104:in `block in spawn_thread'
The other answers related to this error all seem to be about forcing the encoding of the file. But the issue here seems to be 1) sometimes it's a binary (xls) and sometimes text (csv) so I can't go around mangling it and 2) the exception is in ActionDispatch; so looks like it's happening before I get to see the upload.
Any ideas what's going on and what I can do to fix it?
UPDATE: I can now reproduce the issue consistently. If I upload an XLSX file with an English filename, the upload works OK, if it's an XLSX file with Spanish accented in the filename, the upload fails as shown above.
The line in question is #original_filename.encode!(Encoding::UTF_8) in action_dispatch/http/upload.rb - however, the filename should be valid unicode, but it's obviously getting mangled in transit somewhere.