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
0238e681
Commit
0238e681
authored
Sep 17, 2010
by
Jonah Williams
Committed by
Jon Yurek
Jun 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filename returns basename when no extension present
parent
e703662f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
lib/paperclip/interpolations.rb
+1
-1
test/interpolations_test.rb
+7
-0
No files found.
lib/paperclip/interpolations.rb
View file @
0238e681
...
...
@@ -35,7 +35,7 @@ module Paperclip
# Returns the filename, the same way as ":basename.:extension" would.
def
filename
attachment
,
style_name
"
#{
basename
(
attachment
,
style_name
)
}
.
#{
extension
(
attachment
,
style_name
)
}
"
(
ext
=
extension
(
attachment
,
style_name
)).
blank?
?
basename
(
attachment
,
style_name
)
:
"
#{
basename
(
attachment
,
style_name
)
}
.
#{
ext
}
"
end
# Returns the interpolated URL. Will raise an error if the url itself
...
...
test/interpolations_test.rb
View file @
0238e681
...
...
@@ -110,6 +110,13 @@ class InterpolationsTest < Test::Unit::TestCase
assert_equal
"one.png"
,
Paperclip
::
Interpolations
.
filename
(
attachment
,
:style
)
end
should
"return the filename as basename when extension is blank"
do
attachment
=
mock
attachment
.
stubs
(
:styles
).
returns
({})
attachment
.
stubs
(
:original_filename
).
returns
(
"one"
)
assert_equal
"one"
,
Paperclip
::
Interpolations
.
filename
(
attachment
,
:style
)
end
should
"return the timestamp"
do
now
=
Time
.
now
zone
=
'UTC'
...
...
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