Doesn't support Carrierwave's url-based upload system #16

Closed
shawndrost opened this Issue May 9, 2012 · 1 comment

Projects

None yet

2 participants

Using carrierwave's url-based uploader throws this exception:

ruby-1.9.3-p125 :001 > Picture.create remote_img_url: "http://lorempixel.com/240/85/?cachebust=7009",
NameError: undefined local variable or method `public_id' for Cloudinary::CarrierWave:Module
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave.rb:113:in `split_format'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave/process.rb:115:in `format'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave.rb:50:in `filename'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/storage/abstract.rb:19:in `identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/uploader/proxy.rb:35:in `identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:296:in `write_identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:229:in `write_img_identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:407:in `_run__3768434823215381851__save__2003508284864095768__callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/callbacks.rb:264:in `create_or_update'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/persistence.rb:84:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/validations.rb:50:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:208:in `transaction'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:241:in `block in save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:240:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/persistence.rb:45:in `create'
    from (irb):1
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'ruby-1.9.3-p125 :002 > Picture.create remote_img_url: "http://lorempixel.com/240/85/?cachebust=7009", user: User.first

Picture.rb looks something like this:

class Picture < ActiveRecord::Base
  mount_uploader :img, PictureUploader
end

Thanks in advance for any help!

Collaborator
nadavs commented May 9, 2012

Thanks for reporting this.
The GEM did support remote URLs. There was an issue with remote URLs of images without file extension.
It is fixed now. The fix is included in v1.0.21 of the GEM.

@nadavs nadavs closed this May 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment