Module: Uploader

Defined in:
lib/uploader/config.rb,
lib/uploader/engine.rb,
lib/uploader/exceptions.rb,
lib/uploader/models/upload.rb,
lib/uploader/mime_type_groups.rb,
lib/uploader/middleware/flash_session_cookie_middleware.rb

Overview

Configures the uploader gem

For example:

Uploader.configure do |config|
  config.enable_s3 = true
  config.s3_no_wait = true
  config.keep_local_file = true
  config.has_attached_file_options = {
    :url               => "/system/:attachment/:id_partition/:style/:basename.:extension",
    :path              => ":rails_root/public:url",
    :styles  => { :icon => "30x30!", 
                  :thumb => "100>", 
                  :small => "150>", 
                  :medium => "300>", 
                  :large => "660>" },
    :default_url => "/images/default.jpg",
    :storage => :s3,
    :s3_credentials => AMAZON_S3_CREDENTIALS,
    :bucket => "assets.example.com",
    :s3_host_alias => "assets.example.com",
    :convert_options => {
      :all => '-quality 80'
    }
 }            
end

Defined Under Namespace

Modules: Exceptions, MimeTypeGroups, Models Classes: Configuration, Engine, FlashSessionCookieMiddleware, UploadsController

Class Method Summary collapse

Class Method Details

.configurationObject



28
29
30
31
# File 'lib/uploader/config.rb', line 28

def self.configuration
  # In case the user doesn't setup a configure block we can always return default settings:
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



33
34
35
36
# File 'lib/uploader/config.rb', line 33

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end