Commit 8697826a by Henrik N

Include mtime in url if present.

parent 293afb05
......@@ -76,7 +76,8 @@ module Paperclip
# This is not recommended if you don't need the security, however, for
# performance reasons.
def url style = default_style
original_filename.nil? ? interpolate(@default_url, style) : interpolate(@url, style)
url = original_filename.nil? ? interpolate(@default_url, style) : interpolate(@url, style)
[url, mtime].compact.join(url.include?("?") ? "&" : "?")
end
# Returns the path of the attachment as defined by the :path option. If the
......@@ -126,6 +127,11 @@ module Paperclip
def original_filename
instance[:"#{name}_file_name"]
end
def mtime
time = instance[:"#{name}_updated_at"]
time && time.to_i
end
# A hash of procs that are run during the interpolation of a path or url.
# A variable of the format :name will be replaced with the return value of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment