Help requested debugging "undefined method `image_data' for …"

292 views
Skip to first unread message

marckoh...@gmail.com

unread,
Apr 28, 2017, 9:01:25 AM4/28/17
to Shrine
My exception logs show the following exception:

undefined method `image_data' for #<Attachment:0x007fdad8383348>

Where Attachment is my regular ActiveRecord model (think of it like Photo from the Shrine examples).

I've been unable to reproduce this exception, but it happens quite frequently to my users.

Without diving to deep in my application-specific code, the exception occurs when showing a form (GET request) which uses:

attachment.image.present?

… to check whether this attachment already has an image attached to it yet (e.g. when editing an existing record) or whether it's a new record without an image attached.

Note that I'm calling image, not image_data so somewhere Shrine must be calling image_data somewhere which for whatever reason does not exist (even though the attachments table does in fact have a image_data column).

I realize this is not much to go on, but hopefully someone can give me some points on how to debug this seeing I'm unable to reproduce the problem myself.

marckoh...@gmail.com

unread,
Apr 28, 2017, 9:40:05 AM4/28/17
to Shrine, marckoh...@gmail.com
Looks like I occasionally get the same error when updating my Post record which has_many Attachments.

Here's the relevant part of what gets PATCH'ed to the Controller and ultimately passed to the Post.update method. (All Attachment attributes are permitted) 

"attachments_attributes": {
     
"0": {
       
"_destroy": "1",
       
"primary": "0",
       
"thumbnail": "0",
       
"id": "53639"
     
},
     
"1": {
       
"_destroy": "false",
       
"primary": "0",
       
"thumbnail": "0",
       
"id": "53641"
     
},
     
"2": {
       
"_destroy": "1",
       
"primary": "0",
       
"thumbnail": "0",
       
"id": "53640"
     
},
     
"3": {
       
"_destroy": "false",
       
"primary": "0",
       
"thumbnail": "0",
       
"id": "53638"
     
},
     
"4": {
       
"_destroy": "false",
       
"primary": "0",
       
"thumbnail": "0",
       
"id": "53637"
     
},
     
"5": {
       
"_destroy": "false",
       
"primary": "1",
       
"thumbnail": "0",
       
"id": "53636"
     
},
     
"1493381668941": {
       
"_destroy": "false",
       
"image": "{\"id\":\"04c6d3b1550f93f115b5dc3e5cc4b75b.jpg\",\"storage\":\"cache\",\"metadata\":{\"size\":159911,\"filename\":\"Zybra.jpg\",\"mime_type\":\"image/jpeg\"}}",
       
"primary": "1",
       
"thumbnail": "0"
     
}

marckoh...@gmail.com

unread,
Apr 28, 2017, 9:42:26 AM4/28/17
to Shrine, marckoh...@gmail.com
Full stack trace:

vendor/bundle/ruby/2.4.0/gems/activemodel-4.2.8/lib/active_model/attribute_methods.rb:433:in `method_missing': undefined method `image_data' for #<Attachment:0x007f68d8d1bc10>
Did you mean?  image_attacher (NoMethodError)
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:607:in `read'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:601:in `get'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:514:in `set'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:655:in `assign_cached'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:503:in `assign'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine/plugins/rack_file.rb:93:in `assign'
    from vendor/bundle/ruby/2.4.0/gems/shrine-2.6.1/lib/shrine.rb:407:in `image='
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:54:in `public_send'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/core.rb:566:in `init_attributes'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/core.rb:281:in `initialize'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/inheritance.rb:61:in `new'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/inheritance.rb:61:in `new'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/reflection.rb:141:in `build_association'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/associations/association.rb:250:in `build_record'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/associations/collection_association.rb:153:in `build'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/nested_attributes.rb:465:in `block in assign_nested_attributes_for_collection_association'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/nested_attributes.rb:460:in `each'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/nested_attributes.rb:460:in `assign_nested_attributes_for_collection_association'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/nested_attributes.rb:343:in `attachments_attributes='
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:54:in `public_send'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:65:in `block in assign_nested_parameter_attributes'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:65:in `each'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:65:in `assign_nested_parameter_attributes'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/attribute_assignment.rb:45:in `assign_attributes'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:251:in `block in update'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:220:in `transaction'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:250:in `update'
    from app/controllers/admin/startups_controller.rb:35:in `update'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:198:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:19:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:137:in `process'
    from vendor/bundle/ruby/2.4.0/gems/actionview-4.2.8/lib/action_view/rendering.rb:30:in `process'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal.rb:196:in `dispatch'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_controller/metal.rb:237:in `block in action'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:43:in `serve'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/mapper.rb:49:in `serve'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:43:in `block in serve'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:30:in `each'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:30:in `serve'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:817:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
    from vendor/bundle/ruby/2.4.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
    from vendor/bundle/ruby/2.4.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:147:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/deflater.rb:35:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/etag.rb:24:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/conditionalget.rb:38:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/head.rb:13:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:147:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/flash.rb:260:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:225:in `context'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:220:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/cookies.rb:560:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/query_cache.rb:36:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:38:in `call_app'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `call'
    from vendor/bundle/ruby/2.4.0/gems/ahoy_matey-1.5.5/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/request_store-1.3.2/lib/request_store/middleware.rb:9:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/static.rb:120:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/font_assets-0.1.12/lib/font_assets/middleware.rb:29:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/ssl.rb:24:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/skylight-1.2.0/lib/skylight/middleware.rb:61:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:518:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/application.rb:165:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `public_send'
    from vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `method_missing'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.1.0.333/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/configuration.rb:224:in `call'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:600:in `handle_request'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:435:in `process_client'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:299:in `block in run'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

Janko Marohnić

unread,
Apr 28, 2017, 11:50:16 AM4/28/17
to Marc Köhlbrugge, Shrine
Since Shrine doesn't touch the `#image_data` model method in any way, without a self-contained example that reproduces the problem I can only say that it looks like the Attachment model instance somehow doesn't respond to `#image_data` at that time (and Shrine needs it to read attachment data from it).

You can add a `puts` statement before calling `attachment.image.present?` that checks whether the Attachment instance responds to `#image_data`, just to make sure. Otherwise, if the method just randomly disappears when calling `attachment.image` then I need to be able to reproduce the problem (you can use a template from CONTRIBUTING.md).

Kind regards,
Janko

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/d9d80d97-ba26-488e-a3f5-1624118419c1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages