Skip to content

Commit

Permalink
Cosmetic changes to fingerprinting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Aug 16, 2010
1 parent 2cdeb39 commit 15c6c9e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/paperclip/attachment.rb
Expand Up @@ -15,7 +15,7 @@ def self.default_options
:default_url => "/:attachment/:style/missing.png",
:default_style => :original,
:storage => :filesystem,
:include_updated_timestamp => true,
:use_timestamp => true,
:whiny => Paperclip.options[:whiny] || Paperclip.options[:whiny_thumbnails]
}
end
Expand All @@ -40,7 +40,7 @@ def initialize name, instance, options = {}
@default_url = options[:default_url]
@default_style = options[:default_style]
@storage = options[:storage]
@include_updated_timestamp = options[:include_updated_timestamp]
@use_timestamp = options[:use_timestamp]
@whiny = options[:whiny_thumbnails] || options[:whiny]
@convert_options = options[:convert_options]
@processors = options[:processors]
Expand Down Expand Up @@ -100,7 +100,7 @@ def assign uploaded_file
post_process

# Reset the file size if the original file was reprocessed.
instance_write(:file_size, @queued_for_write[:original].size.to_i)
instance_write(:file_size, @queued_for_write[:original].size.to_i)
instance_write(:fingerprint, @queued_for_write[:original].fingerprint)
ensure
uploaded_file.close if close_uploaded_file
Expand All @@ -110,12 +110,11 @@ def assign uploaded_file
# this does not necessarily need to point to a file that your web server
# can access and can point to an action in your app, if you need fine
# grained security. This is not recommended if you don't need the
# security, however, for performance reasons. set
# include_updated_timestamp to false if you want to stop the attachment
# update time appended to the url
def url(style_name = default_style, include_updated_timestamp = @include_updated_timestamp)
# security, however, for performance reasons. Set use_timestamp to false
# if you want to stop the attachment update time appended to the url
def url(style_name = default_style, use_timestamp = @use_timestamp)
url = original_filename.nil? ? interpolate(@default_url, style_name) : interpolate(@url, style_name)
include_updated_timestamp && updated_at ? [url, updated_at].compact.join(url.include?("?") ? "&" : "?") : url
use_timestamp && updated_at ? [url, updated_at].compact.join(url.include?("?") ? "&" : "?") : url
end

# Returns the path of the attachment as defined by the :path option. If the
Expand Down

0 comments on commit 15c6c9e

Please sign in to comment.