Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional version returns wrong url when retrieving from store (but works when storing) #1350

Closed
filipegiusti opened this issue Mar 21, 2014 · 1 comment · Fixed by #1351

Comments

@filipegiusti
Copy link
Contributor

The code speaks for itself

require 'carrierwave'

class BugUploader < CarrierWave::Uploader::Base
  version :thumb, if: :always_false do
    def default_url
      'default.png'
    end
  end

  def root
    '~'
  end

  def always_false(*args)
    false
  end
end

up1 = BugUploader.new
up1.store!(File.open(__FILE__))
puts up1.thumb.url
# default.png

up2 = BugUploader.new
up2.retrieve_from_store!('lalala.png')
puts up2.thumb.url
# /uploads/thumb_lalala.png
@bensie
Copy link
Member

bensie commented Apr 3, 2014

Closing in favor of #1351 and moving the conversation there.

@bensie bensie closed this as completed Apr 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants