Sha256: 6bcfcf429cc29f69050b64e12a71938ea550fc00ed1252847097bd50cf51a1a6

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

module Paperclip
  class Attachment
    def self.default_options
      #Credit http://www.jonathanspies.com/posts/6-Using-yaml-to-configure-default-options-for-Paperclip
      # look for paperclip environment overrides in paperclip.yml
      return @default_options if @default_options

      @default_options = {
        :url                   => "/system/:attachment/:id/:style/:filename",
        :path                  => ":rails_root/public:url",
        :styles                => {},
        :only_process          => [],
        :processors            => [:thumbnail],
        :convert_options       => {},
        :default_url           => "/:attachment/:style/missing.png",
        :default_style         => :original,
        :storage               => :filesystem,
        :use_timestamp         => true,
        :use_default_time_zone => true,
        :hash_digest           => "SHA1",
        :hash_data             => ":class/:attachment/:id/:style/:updated_at",
        :preserve_files        => false
      }

      if defined?(RAILS_ROOT) and File.exists?("#{RAILS_ROOT}/config/paperclip.yml")
        @default_options.merge!(YAML.load_file("#{RAILS_ROOT}/config/paperclip.yml")[RAILS_ENV].symbolize_keys) rescue nil
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soapbox-0.1.3 lib/soapbox/paperclip.rb
soapbox-0.1.2 lib/soapbox/paperclip.rb
soapbox-0.1.1 lib/soapbox/paperclip.rb