Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
8697826a
Commit
8697826a
authored
Jul 02, 2008
by
Henrik N
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include mtime in url if present.
parent
293afb05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
lib/paperclip/attachment.rb
+7
-1
No files found.
lib/paperclip/attachment.rb
View file @
8697826a
...
@@ -76,7 +76,8 @@ module Paperclip
...
@@ -76,7 +76,8 @@ module Paperclip
# This is not recommended if you don't need the security, however, for
# This is not recommended if you don't need the security, however, for
# performance reasons.
# performance reasons.
def
url
style
=
default_style
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
end
# Returns the path of the attachment as defined by the :path option. If the
# Returns the path of the attachment as defined by the :path option. If the
...
@@ -126,6 +127,11 @@ module Paperclip
...
@@ -126,6 +127,11 @@ module Paperclip
def
original_filename
def
original_filename
instance
[
:"
#{
name
}
_file_name"
]
instance
[
:"
#{
name
}
_file_name"
]
end
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 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
# A variable of the format :name will be replaced with the return value of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment