Skip to content

Instantly share code, notes, and snippets.

@millisami
Forked from anonymous/gist:4393062
Created April 30, 2013 07:30
Show Gist options
  • Save millisami/5487158 to your computer and use it in GitHub Desktop.
Save millisami/5487158 to your computer and use it in GitHub Desktop.
if Rails.env.development?
module Dragonfly
module DataStorage
class FileDataStore
def retrieve(relative_path)
validate_uid!(relative_path)
path = absolute(relative_path)
pathname = Pathname.new(path)
if !pathname.exist?
pathname = Pathname.new('/path/to/default-image.jpg')
end
raise DataNotFound, "couldn't find file #{ENV['RAILS_ROOT']}" unless pathname.exist?
[
pathname,
(store_meta ? retrieve_meta_data(path) : {})
]
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment