Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

When editing the record that uses Carrierwave, I get a 'has thumb_image_changed' error even though I am not updating any images #941

Closed
marcamillion opened this Issue · 3 comments

2 participants

@marcamillion

This is the error I get when I try to update a non-image attribute of a record on my Vendor model (e.g. the owner):

NoMethodError at /admin/vendor/12/edit

Message undefined method `thumb_image_changed?' for #<Vendor:0x007ff47d097468>
File    /.rvm/gems/ruby-1.9.3-p194@my-app/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb
Line    407

So, this error is generated even though I am not changing the image.

It should be noted that I am updating this record in RailsAdmin - if that has any bearing.

The image is pushed to S3 using FOG.

This is what my Vendor model looks like:

class Vendor < ActiveRecord::Base
  attr_accessible :name, :description, :banner_image, :logo_image, :intro_text, :thumb_image, :category_ids, :product_ids, :user_id, :remove_banner_image, :banner_image_cache, :remove_logo_image, :logo_image_cache
    mount_uploader :banner_image, ImageUploader
    mount_uploader :logo_image, ImageUploader
    mount_uploader :thumb_image, ImageUploader

has_many :products, :dependent => :destroy
has_many :categories, :through => :products
belongs_to :owner, :class_name => "User",
    :foreign_key => "user_id"   
end

I think I get a similar error when I try to update just one of the images of a record (and not all 3).

What could be causing this and how do I fix it?

Thanks.

@bensie
Owner

Can you provide a full stack trace? I don't see anything to indicate this error is being emitted by CarrierWave.

@marcamillion

Just did it again, and this is the error I get (which is very similar to the one above, but a bit different):

NoMethodError at /vendors/12

Message undefined method `thumb_image_changed?' for #<Vendor:0x007fcda95da308>
File    /.rvm/gems/ruby-1.9.3-p194@myapp/gems/activemodel-3.2.10/lib/active_model/attribute_methods.rb
Line    407

Here is the full stack trace of that error message:

Vendor#method_missing
(gem) activemodel-3.2.10/lib/active_model/attribute_methods.rb, line 407
Vendor#method_missing
(gem) activerecord-3.2.10/lib/active_record/attribute_methods.rb, line 149
Vendor#store_previous_model_for_thumb_image
(gem) carrierwave-0.7.0/lib/carrierwave/mount.rb, line 244
Vendor#_run__996845930524640532__update__2656793579943529639__callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 429
Vendor.__run_callback
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 405
Vendor#_run_update_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 385
Vendor#run_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 81
Vendor#update
(gem) activerecord-3.2.10/lib/active_record/callbacks.rb, line 272
Vendor#create_or_update
(gem) activerecord-3.2.10/lib/active_record/persistence.rb, line 348
block in Vendor#create_or_update
(gem) activerecord-3.2.10/lib/active_record/callbacks.rb, line 264
Vendor#_run__996845930524640532__save__2656793579943529639__callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 458
Vendor.__run_callback
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 405
Vendor#_run_save_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 385
Vendor#run_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 81
Vendor#create_or_update
(gem) activerecord-3.2.10/lib/active_record/callbacks.rb, line 264
Vendor#save
(gem) activerecord-3.2.10/lib/active_record/persistence.rb, line 84
Vendor#save
(gem) activerecord-3.2.10/lib/active_record/validations.rb, line 50
Vendor#save
(gem) activerecord-3.2.10/lib/active_record/attribute_methods/dirty.rb, line 22
block (2 levels) in Vendor#save
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 259
block in Vendor#with_transaction_returning_status
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 313
ActiveRecord::ConnectionAdapters::SQLite3Adapter#transaction
(gem) activerecord-3.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb, line 192
Vendor.transaction
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 208
Vendor#with_transaction_returning_status
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 311
block in Vendor#save
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 259
Vendor#rollback_active_record_state!
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 270
Vendor#save
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 258
block in Vendor#update_attributes
(gem) activerecord-3.2.10/lib/active_record/persistence.rb, line 217
block in Vendor#with_transaction_returning_status
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 313
ActiveRecord::ConnectionAdapters::SQLite3Adapter#transaction
(gem) activerecord-3.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb, line 192
Vendor.transaction
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 208
Vendor#with_transaction_returning_status
(gem) activerecord-3.2.10/lib/active_record/transactions.rb, line 311
Vendor#update_attributes
(gem) activerecord-3.2.10/lib/active_record/persistence.rb, line 215
block in VendorsController#update
app/controllers/vendors_controller.rb, line 64
VendorsController#retrieve_collector_from_mimes
(gem) actionpack-3.2.10/lib/action_controller/metal/mime_responds.rb, line 270
VendorsController#respond_to
(gem) actionpack-3.2.10/lib/action_controller/metal/mime_responds.rb, line 270
VendorsController#update
(gem) actionpack-3.2.10/lib/action_controller/metal/mime_responds.rb, line 194
VendorsController#send_action
app/controllers/vendors_controller.rb, line 63
VendorsController#process_action
(gem) actionpack-3.2.10/lib/action_controller/metal/implicit_render.rb, line 4
VendorsController#process_action
(gem) actionpack-3.2.10/lib/abstract_controller/base.rb, line 167
VendorsController#process_action
(gem) actionpack-3.2.10/lib/action_controller/metal/rendering.rb, line 10
block in VendorsController#_run__2306989766687679399__process_action__1194575972186888233__callbacks
(gem) actionpack-3.2.10/lib/abstract_controller/callbacks.rb, line 18
VendorsController.__run_callback
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 425
VendorsController#_run_process_action_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 405
VendorsController#run_callbacks
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 385
VendorsController#process_action
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 81
VendorsController#process_action
(gem) actionpack-3.2.10/lib/abstract_controller/callbacks.rb, line 17
VendorsController#process_action
(gem) actionpack-3.2.10/lib/action_controller/metal/rescue.rb, line 29
block in ActiveSupport::Notifications.instrument
(gem) actionpack-3.2.10/lib/action_controller/metal/instrumentation.rb, line 30
block in ActiveSupport::Notifications::Instrumenter#instrument
(gem) activesupport-3.2.10/lib/active_support/notifications.rb, line 123
ActiveSupport::Notifications.instrument
(gem) activesupport-3.2.10/lib/active_support/notifications/instrumenter.rb, line 20
VendorsController#process_action
(gem) activesupport-3.2.10/lib/active_support/notifications.rb, line 123
VendorsController#process_action
(gem) actionpack-3.2.10/lib/action_controller/metal/instrumentation.rb, line 29
VendorsController#process_action
(gem) actionpack-3.2.10/lib/action_controller/metal/params_wrapper.rb, line 207
VendorsController#process
(gem) activerecord-3.2.10/lib/active_record/railties/controller_runtime.rb, line 18
VendorsController#process
(gem) actionpack-3.2.10/lib/abstract_controller/base.rb, line 121
VendorsController#dispatch
(gem) actionpack-3.2.10/lib/abstract_controller/rendering.rb, line 45
VendorsController#dispatch
(gem) actionpack-3.2.10/lib/action_controller/metal.rb, line 203
VendorsController.action
(gem) actionpack-3.2.10/lib/action_controller/metal/rack_delegation.rb, line 14
block in ActionDispatch::Routing::RouteSet::Dispatcher#dispatch
(gem) actionpack-3.2.10/lib/action_controller/metal.rb, line 246
ActionDispatch::Routing::RouteSet::Dispatcher#call
(gem) actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb, line 73
Journey::Router#call
(gem) actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb, line 73
Journey::Router#call
(gem) actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb, line 36
block in ActionDispatch::Routing::RouteSet#call
(gem) journey-1.0.4/lib/journey/router.rb, line 68
Rack::Pjax#call
(gem) journey-1.0.4/lib/journey/router.rb, line 56
BetterErrors::Middleware#app_call
(gem) journey-1.0.4/lib/journey/router.rb, line 56
BetterErrors::Middleware#call
(gem) actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb, line 601
Warden::Manager#call
(gem) rack-pjax-0.6.0/lib/rack/pjax.rb, line 12
Warden::Manager#call
(gem) better_errors-0.0.7/lib/better_errors/middleware.rb, line 20
ActionDispatch::BestStandardsSupport#call
(gem) better_errors-0.0.7/lib/better_errors/middleware.rb, line 14
block in Rack::ETag#call
(gem) warden-1.2.1/lib/warden/manager.rb, line 35
Rack::ConditionalGet#call
(gem) warden-1.2.1/lib/warden/manager.rb, line 34
ActionDispatch::Head#call
(gem) warden-1.2.1/lib/warden/manager.rb, line 34
Remotipart::Middleware#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/best_standards_support.rb, line 17
ActionDispatch::ParamsParser#call
(gem) rack-1.4.1/lib/rack/etag.rb, line 23
ActionDispatch::Flash#call
(gem) rack-1.4.1/lib/rack/conditionalget.rb, line 35
ActionDispatch::Session::CookieStore#context
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/head.rb, line 14
ActionDispatch::Session::CookieStore#call
(gem) remotipart-1.0.2/lib/remotipart/middleware.rb, line 30
ActionDispatch::Cookies#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/params_parser.rb, line 21
ActiveRecord::QueryCache#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/flash.rb, line 242
ActiveRecord::ConnectionAdapters::ConnectionManagement#call
(gem) rack-1.4.1/lib/rack/session/abstract/id.rb, line 205
ActionDispatch::Callbacks#call
(gem) rack-1.4.1/lib/rack/session/abstract/id.rb, line 200
ActionDispatch::Callbacks#_run__1910154788260386208__call__2656793579943529639__callbacks
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/cookies.rb, line 341
ActionDispatch::Callbacks.__run_callback
(gem) activerecord-3.2.10/lib/active_record/query_cache.rb, line 64
ActionDispatch::Callbacks#_run_call_callbacks
(gem) activerecord-3.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 479
block in ActionDispatch::Callbacks#run_callbacks
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/callbacks.rb, line 28
ActionDispatch::Callbacks#call
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 405
ActionDispatch::Reloader#call
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 405
ActionDispatch::RemoteIp#call
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 385
ActionDispatch::DebugExceptions#call
(gem) activesupport-3.2.10/lib/active_support/callbacks.rb, line 81
ActionDispatch::ShowExceptions#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/callbacks.rb, line 27
Rails::Rack::Logger#call_app
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/reloader.rb, line 65
Rails::Rack::Logger#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/remote_ip.rb, line 31
ActiveSupport::TaggedLogging#tagged
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/debug_exceptions.rb, line 16
Rails::Rack::Logger#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/show_exceptions.rb, line 56
Rails::Rack::Logger#call_with_quiet_assets
(gem) railties-3.2.10/lib/rails/rack/logger.rb, line 32
block in ActionDispatch::RequestId#call
(gem) railties-3.2.10/lib/rails/rack/logger.rb, line 16
Rack::MethodOverride#call
(gem) activesupport-3.2.10/lib/active_support/tagged_logging.rb, line 22
Rack::Runtime#call
(gem) railties-3.2.10/lib/rails/rack/logger.rb, line 16
ActiveSupport::Cache::Strategy::LocalCache::Middleware#call
(gem) quiet_assets-1.0.1/lib/quiet_assets.rb, line 20
Rack::Lock#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/request_id.rb, line 22
ActionDispatch::Static#call
(gem) rack-1.4.1/lib/rack/methodoverride.rb, line 21
Apt605::Application#call
(gem) rack-1.4.1/lib/rack/runtime.rb, line 17
Apt605::Application#call
(gem) activesupport-3.2.10/lib/active_support/cache/strategy/local_cache.rb, line 72
Rack::ContentLength#call
(gem) rack-1.4.1/lib/rack/lock.rb, line 15
Rails::Rack::LogTailer#call
(gem) actionpack-3.2.10/lib/action_dispatch/middleware/static.rb, line 62
Thin::Connection#pre_process
(gem) railties-3.2.10/lib/rails/engine.rb, line 479
Thin::Connection#pre_process
(gem) railties-3.2.10/lib/rails/application.rb, line 223
Thin::Connection#process
(gem) rack-1.4.1/lib/rack/content_length.rb, line 14
Thin::Connection#receive_data
(gem) railties-3.2.10/lib/rails/rack/log_tailer.rb, line 17
block in EventMachine.run
(gem) thin-1.5.0/lib/thin/connection.rb, line 81
Thin::Backends::TcpServer#start
(gem) thin-1.5.0/lib/thin/connection.rb, line 79
Thin::Server#start
(gem) thin-1.5.0/lib/thin/connection.rb, line 79
Rack::Handler::Thin.run
(gem) thin-1.5.0/lib/thin/connection.rb, line 54
Rails::Server#start
(gem) thin-1.5.0/lib/thin/connection.rb, line 39
Rails::Server#start
(gem) eventmachine-1.0.0/lib/eventmachine.rb, line 187
Object#
(gem) eventmachine-1.0.0/lib/eventmachine.rb, line 187
Object#
(gem) thin-1.5.0/lib/thin/backends/base.rb, line 63
Object#
(gem) thin-1.5.0/lib/thin/server.rb, line 159
Object#
(gem) rack-1.4.1/lib/rack/handler/thin.rb, line 13
start
(gem) rack-1.4.1/lib/rack/server.rb, line 265
start
(gem) railties-3.2.10/lib/rails/commands/server.rb, line 70
block in <top (required)>
(gem) railties-3.2.10/lib/rails/commands.rb, line 55
tap
(gem) railties-3.2.10/lib/rails/commands.rb, line 50
<top (required)>
(gem) railties-3.2.10/lib/rails/commands.rb, line 50
require
script/rails, line 6
<main>
script/rails, line 6
@marcamillion

It seems that the issue is that I didn't have a thumb_image column on my Vendor model. Turns out I had gotten rid of that column and forgot to take it out of the mount_uploader call on my model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.