Skip to content

Instantly share code, notes, and snippets.

@codeinmotion
Forked from duykhoa/paperclip_storage_option.rb
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save codeinmotion/91ae11c3ea889d5ee513 to your computer and use it in GitHub Desktop.

Select an option

Save codeinmotion/91ae11c3ea889d5ee513 to your computer and use it in GitHub Desktop.
module PaperclipStorageOption
module ClassMethods
def options
Rails.env.production? ? production_options : default_options
end
private
def production_options
{
storage: :dropbox,
dropbox_credentials: Rails.root.join("config/dropbox.yml")
}
end
def default_options
{}
end
end
extend ClassMethods
end
has_attached_file :image, { :styles => { :medium => "1200x800>" } }.merge(PaperclipStorageOption.options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment