undefined method `call' for :notifo:Symbol - ruby-on-rails

I have a rails app which is running rails 3.2.22 on Ruby 2.2.5 on Heroku.
I am getting an error which I am having trouble diagnosing;
NoMethodError (undefined method `call' for :notifo:Symbol):
This is the stack trace for it:
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/deprecation/reporting.rb:13:in `block (2 levels) in warn'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/deprecation/reporting.rb:13:in `each'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/deprecation/reporting.rb:13:in `block in warn'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/deprecation/reporting.rb:12:in `tap'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/deprecation/reporting.rb:12:in `warn'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:212:in `block in clear_stale_cached_connections!'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:210:in `each'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:210:in `clear_stale_cached_connections!'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:274:in `block (2 levels) in checkout'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
vendor/ruby-2.2.5/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
vendor/ruby-2.2.5/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/query_cache.rb:67:in `rescue in call'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/query_cache.rb:61:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `_run__1702427010739121446__call__964470083021375166__callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/request_store-1.3.2/lib/request_store/middleware.rb:9:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/static.rb:83:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-ssl-1.3.4/lib/rack/ssl.rb:27:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.7.1/lib/rack/cache/context.rb:140:in `forward'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.7.1/lib/rack/cache/context.rb:249:in `fetch'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.7.1/lib/rack/cache/context.rb:189:in `lookup'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.7.1/lib/rack/cache/context.rb:66:in `call!'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.7.1/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/engine.rb:484:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/application.rb:231:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.4.245/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/server.rb:624:in `handle_request'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/server.rb:438:in `process_client'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/server.rb:302:in `block in run'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/thread_pool.rb:120:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-3.11.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
To start with the app functions normally, but then after a bunch of requests are made in quick succession this error crops up and then all subsequent requests (which had been working fine before) throw this error and the app crashes.
I can't find any reference to this particular error and I'm rather stumped. The app does not appear to be hitting heroku memory limits so I don't think that is the cause. Could this be a rails 3 issue, or the result of upgrading to rails 3 (from 2)?
Any help on this would be greatly appreciated! thanks.

Related

ActiveRecord::RecordNotFound at Active Storage redirect

My application uses Active Storage to manage images (attached to articles, user avatars, etc) and I get constant 500 errors when processing links of the following style:
/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBODYwR1E9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--ac33ecf9f5dffc2b8345b443c402562e4fb6afaf/F582BAA7-DD39-4A7A-8E82-919EC8AFC12C.jpeg
These links are sometimes visited by search engine bots, and sometimes because other websites point to images of my application that no longer exist.
To generate the links to the images I use the helper recommended by Rails, which point to the assets through a redirect (url_for(element.attachment) for example).
The thing is that if the assets no longer exist, because a user has changed avatar for example, or because in an article an image has been replaced, these links generate errors with status 500 instead of 404 errors.
Am I confused and I am not using the right helper to generate the image paths? I have investigated in the Ruby Gem and I don't see any option to change the behavior, since the error is given when looking for the ActiveRecord of the blob in database. This is the trace:
vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/core.rb:284:in `find': Couldn't find ActiveStorage::Blob with 'id'=1684686 (ActiveRecord::RecordNotFound)
from vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/signed_id.rb:64:in `find_signed!'
from vendor/bundle/ruby/3.1.0/gems/activestorage-7.0.4/app/models/active_storage/blob.rb:87:in `find_signed!'
from vendor/bundle/ruby/3.1.0/gems/activestorage-7.0.4/app/controllers/concerns/active_storage/set_blob.rb:12:in `set_blob'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:400:in `block in make_lambda'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:200:in `block in halting'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `block in invoke_before'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `each'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `invoke_before'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:116:in `block in run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.4/lib/action_text/rendering.rb:20:in `with_renderer'
from vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.4/lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:127:in `instance_exec'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:138:in `run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:233:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `block in instrument'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `instrument'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:151:in `process'
from vendor/bundle/ruby/3.1.0/gems/actionview-7.0.4/lib/action_view/rendering.rb:39:in `process'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:188:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:251:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `each'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:852:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/rack/browser_monitoring.rb:38:in `traced_call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/http_accept_language-2.1.1/lib/http_accept_language/middleware.rb:14:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/conditional_get.rb:27:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/cookies.rb:696:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:99:in `run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/bugsnag-6.25.0/lib/bugsnag/integrations/rack.rb:51:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:40:in `call_app'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `block in call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:37:in `tagged'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `tagged'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/static.rb:23:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/ssl.rb:77:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-utf8_sanitizer-1.8.0/lib/rack/utf8_sanitizer.rb:28:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:530:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/configuration.rb:268:in `call'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'
Do you have any suggestion to make a better use of Active Storage? Do you avoid the error in any way in your applications?
Thank you very much in advance!
Check if this solves your issue:
Rails.application.routes.url_helpers.polymorphic_url(user.avatar)
I just realized that I am confusing a "500 status error" with an INFO level exception. The application responds fine: it displays a 404 error, but my error handler app gets an INFO level exception and I was interpreting it as my users being shown an error screen, when really the application was handling the situation fine.

ActiveStorage S3 file upload undefined keyword content_type

I'm encountering an issue with ActiveStorage while uploading a file to S3.
I get an ArgumentError (unknown keyword: content_type) in active_storage/service/s3_service.rb and can't find the source of the issue.
Stacktrace:
ArgumentError: unknown keyword: content_type
from active_storage/service/s3_service.rb:19:in `upload'
from active_storage/blob.rb:155:in `upload'
from active_storage/blob.rb:53:in `block in build_after_upload'
from active_storage/blob.rb:48:in `tap'
from active_storage/blob.rb:48:in `build_after_upload'
from active_storage/blob.rb:61:in `create_after_upload!'
from active_storage/attached.rb:23:in `create_blob_from'
from active_storage/attached/one.rb:24:in `attach'
from app/controllers/admin/venues_controller.rb:48:in `update'
from action_controller/metal/basic_implicit_render.rb:6:in `send_action'
from abstract_controller/base.rb:194:in `process_action'
from action_controller/metal/rendering.rb:30:in `process_action'
from abstract_controller/callbacks.rb:42:in `block in process_action'
from active_support/callbacks.rb:109:in `block in run_callbacks'
from raven/integrations/rails/controller_transaction.rb:7:in `block in included'
from active_support/callbacks.rb:118:in `instance_exec'
from active_support/callbacks.rb:118:in `block in run_callbacks'
from active_support/callbacks.rb:136:in `run_callbacks'
from abstract_controller/callbacks.rb:41:in `process_action'
from action_controller/metal/rescue.rb:22:in `process_action'
from action_controller/metal/instrumentation.rb:34:in `block in process_action'
from active_support/notifications.rb:168:in `block in instrument'
from active_support/notifications/instrumenter.rb:23:in `instrument'
from active_support/notifications.rb:168:in `instrument'
from action_controller/metal/instrumentation.rb:32:in `process_action'
from action_controller/metal/params_wrapper.rb:256:in `process_action'
from active_record/railties/controller_runtime.rb:24:in `process_action'
from abstract_controller/base.rb:134:in `process'
from action_view/rendering.rb:32:in `process'
from action_controller/metal.rb:191:in `dispatch'
from action_controller/metal.rb:252:in `dispatch'
from action_dispatch/routing/route_set.rb:52:in `dispatch'
from action_dispatch/routing/route_set.rb:34:in `serve'
from action_dispatch/journey/router.rb:52:in `block in serve'
from action_dispatch/journey/router.rb:35:in `each'
from action_dispatch/journey/router.rb:35:in `serve'
from action_dispatch/routing/route_set.rb:840:in `call'
from skylight/core/probes/action_dispatch/routing/route_set.rb:14:in `block in call'
from skylight/core/fanout.rb:25:in `instrument'
from skylight/core/probes/action_dispatch/routing/route_set.rb:13:in `call'
from warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
from warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
from rack/builder.rb:153:in `call'
from warden/jwt_auth/middleware.rb:23:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from i18n/js/middleware.rb:14:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from warden/manager.rb:36:in `block in call'
from warden/manager.rb:34:in `catch'
from warden/manager.rb:34:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/tempfile_reaper.rb:15:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/etag.rb:25:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/conditional_get.rb:38:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/head.rb:12:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/http/content_security_policy.rb:18:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/session/abstract/id.rb:232:in `context'
from rack/session/abstract/id.rb:226:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/cookies.rb:670:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/callbacks.rb:28:in `block in call'
from active_support/callbacks.rb:98:in `run_callbacks'
from action_dispatch/middleware/callbacks.rb:26:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/debug_exceptions.rb:61:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/show_exceptions.rb:33:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rails/rack/logger.rb:38:in `call_app'
from rails/rack/logger.rb:26:in `block in call'
from active_support/tagged_logging.rb:71:in `block in tagged'
from active_support/tagged_logging.rb:28:in `tagged'
from active_support/tagged_logging.rb:71:in `tagged'
from rails/rack/logger.rb:26:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/remote_ip.rb:81:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from request_store/middleware.rb:19:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/request_id.rb:27:in `call'
from skylight/core/probes/action_dispatch/request_id.rb:12:in `call'
from rack/method_override.rb:22:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/runtime.rb:22:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/executor.rb:14:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/sendfile.rb:111:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from action_dispatch/middleware/ssl.rb:74:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from raven/integrations/rack.rb:51:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rack/cors.rb:97:in `call'
from skylight/core/probes/middleware.rb:26:in `call'
from rails/engine.rb:524:in `call'
from puma/configuration.rb:225:in `call'
from puma/server.rb:658:in `handle_request'
from puma/server.rb:472:in `process_client'
from puma/server.rb:332:in `block in run'
from puma/thread_pool.rb:133:in `block in spawn_thread'
The model has one attached logo (an image) and I try to update the model with an image.
has_one_attached :logo
#venue.logo.attach(venue_params[:logo]) if venue_params[:logo].present?
I browsed the ActiveStorage source on GitHub but I can't find the issue with the argument.
In advance, thank you very much!

Grape rescue Grape::Exceptions::ValidationErrors not working

I wrote an api to upload a image file to server.
when I am upload without a file, it will be error
I tried to rescue it like this:
rescue_from Grape::Exceptions::ValidationErrors do |e|
error! e.message, 404
end
but it doesn't work.
Here is error message:
E, [2015-11-23T22:17:44.337050 #10646] ERROR -- : avatar is invalid (Grape::Exceptions::ValidationErrors)
remote_address: 127.0.0.1
token: Basic bGl4aWJveDpsaXhpYXBpMTIzNA==
method: POST
path: /api/v1/users/change_avatar.json
query: {"avatar"=>"undefined"}
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/endpoint.rb:249:in `block in run'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/endpoint.rb:219:in `run'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/endpoint.rb:201:in `block in call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:24:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:24:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:18:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:24:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:18:in `call'
/Users/macstore1/projects/lixibox/app/controllers/api/v1/api_error_handler.rb:9:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:18:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/error.rb:27:in `block in call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/error.rb:26:in `catch'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/error.rb:26:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/middleware/base.rb:18:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/endpoint.rb:202:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/endpoint.rb:190:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:75:in `optimized_each'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/api.rb:114:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/api.rb:44:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/grape-0.13.0/lib/grape/api.rb:39:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:51:in `serve'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `each'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `serve'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:819:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/remotipart-1.2.1/lib/remotipart/middleware.rb:27:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/flash.rb:260:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activerecord-4.2.1/lib/active_record/query_cache.rb:36:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:73:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/airbrake-4.3.0/lib/airbrake/rails/middleware.rb:13:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:84:in `protected_app_call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:79:in `better_errors_call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:57:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/web-console-2.2.1/lib/web_console/middleware.rb:39:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `block in call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/quiet_assets-1.1.0/lib/quiet_assets.rb:27:in `call_with_quiet_assets'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/activesupport-4.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/actionpack-4.2.1/lib/action_dispatch/middleware/static.rb:113:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/airbrake-4.3.0/lib/airbrake/user_informer.rb:16:in `_call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/airbrake-4.3.0/lib/airbrake/user_informer.rb:12:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/engine.rb:518:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/application.rb:164:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/handler/thin.rb:19:in `run'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in `start'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
/Users/macstore1/projects/lixibox/bin/rails:8:in `require'
/Users/macstore1/projects/lixibox/bin/rails:8:in `<top (required)>'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
/Users/macstore1/.rvm/gems/ruby-2.1.6#lixibox/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/macstore1/projects/lixibox/bin/spring:13:in `require'
/Users/macstore1/projects/lixibox/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Maybe there is an error in your API somewhere. The following should work (tested with Grape 0.13.0):
module Api
class API < Grape::API
rescue_from Grape::Exceptions::ValidationErrors do |e|
error! e.message, 404
end
resource '/avatars' do
params do
requires :avatar, type: Rack::Multipart::UploadedFile
end
post '/' do
{
filename: params.avatar.filename,
file_type: params.avatar.type
}
end
end
end
end
Also, if you define a rescue_from :all block, be sure to do it as the last block. By the way, Grape has a pretty good documentation.

I am getting this warning Warning: Error loading

I am upgrading from rails 2.3 to rails 3.2. I have models divided into sub folders. Just like there is a model app/models/ad/ad.rb the other app/models/ad/ad_city.rb but inside the model it is written as:
class Ad < ActiveRecord::Base
class AdCity < ActiveRecord::Base
and not:
class Ad::Ad < ActiveRecord::Base
class Ad::AdCity < ActiveRecord::Base
I have in my application.rb:
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
even I tried including each folder in config.autoload_paths. But it give me a thousand lines warning:
Warning: Error loading /home/deep/projects/upgrade/models/myapp/app/models/ad/ad_city.rb:
uninitialized constant Ad::AdCity
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:64:in `block (2 levels) in load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `block in load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in `load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:15:in `prepare'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:81:in `block in context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:78:in `synchronize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:78:in `context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record.rb:162:in `define_index'
/home/deep/projects/upgrade/models/myapp/app/models/user/user_indexes.rb:6:in `included'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:295:in `include'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:295:in `<class:User>'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:1:in `<top (required)>'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:364:in `block in load_file_with_constant_tracking_internal'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:240:in `now_loading'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:364:in `load_file_with_constant_tracking_internal'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:234:in `block in load_file_with_constant_tracking'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:383:in `async_synchronize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:229:in `load_file_with_constant_tracking'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:108:in `login_from_session'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:24:in `current_user'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:14:in `logged_in?'
/home/deep/projects/upgrade/models/myapp/app/controllers/application_controller.rb:288:in `set_timezone'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:429:in `_run__402496120916004207__process_action__1098406492416702350__callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/rescue.rb:29:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications.rb:123:in `block in instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications.rb:123:in `instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/base.rb:121:in `process'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/rendering.rb:45:in `process'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal.rb:203:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal.rb:246:in `block in action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:73:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:36:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:608:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/exception_notification-4.0.1/lib/exception_notification/rack.rb:28:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/async.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/head.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/flash.rb:242:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/query_cache.rb:64:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `_run__2960753221531180313__call__4371824738127159201__callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:57:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:32:in `call_app'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:16:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/tagged_logging.rb:22:in `tagged'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:16:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/static.rb:63:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/engine.rb:484:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/application.rb:231:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/log_tailer.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
for all the models. It doesn't throw any error just gives warning each time my app makes any connection with the database. What should I do. Please help

Crafting Rails Chapter 7: MultiJson::DecodeError - 756: unexpected token at '"Validation failed: %{errors}"':

I'm following through the 'Crafting Rails' book, and I've come to hurdle I just can't get over in the final Chapter (Chap 7)
When I try to run the project at the end of 7.3, I get:
MultiJson::DecodeError - 756: unexpected token at '"Validation failed: %{errors}"':
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/json-1.6.5/lib/json/common.rb:148:in `parse'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/json-1.6.5/lib/json/common.rb:148:in `parse'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/multi_json-1.1.0/lib/multi_json/engines/json_common.rb:9:in `decode'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/multi_json-1.1.0/lib/multi_json.rb:79:in `decode'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/json/decoding.rb:12:in `decode'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:32:in `locale_value'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:55:in `block in evaluate_source'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:54:in `each'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:54:in `evaluate_source'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:209:in `instance_eval'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:209:in `evaluate_source'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:144:in `cached_evaluate'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:127:in `evaluate'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/haml.rb:24:in `evaluate'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:636:in `render'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:532:in `haml'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:19:in `exhibit_translations'
/Users/john/Manuals/Rails/Crafting Rails/Chap7/translator-old/lib/translator/app.rb:10:in `block in <class:App>'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `block in compile!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `[]'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `block (3 levels) in route!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in `route_eval'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `block (2 levels) in route!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in `block in process_route'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `catch'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `process_route'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in `block in route!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `each'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `route!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in `dispatch!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `block in call!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `block in invoke'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `catch'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `block in call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:in `synchronize'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/journey-1.0.3/lib/journey/router.rb:56:in `each'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/journey-1.0.3/lib/journey/router.rb:56:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/routing/route_set.rb:594:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/plugin/rack.rb:54:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/flash.rb:242:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/cookies.rb:338:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.2/lib/active_record/query_cache.rb:64:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `_run__2584460681594678013__call__1225515721622234840__callbacks'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/rack/logger.rb:26:in `call_app'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/rack/logger.rb:16:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.2/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.2/lib/action_dispatch/middleware/static.rb:61:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/engine.rb:479:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/application.rb:220:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/rack/log_tailer.rb:14:in `call'
/Users/john/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/Users/john/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/john/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/john/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
I've tried stripping all symbols out of that string, but no joy - same issue. Any idea what might be going wrong here? I've literally copied & pasted from the book, so I don't think it's a typo. Could possibly be a redis issue (I'm unfamiliar with it), but it seems to be working fine.
Any ideas appreciated
In gem file declare
gem 'yajl-ruby'
It is used to Parse and encode multiple JSON objects to and from streams or strings continuous.
And require 'yajl/json_gem'
in config/application.rb

Resources