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
7ccefc24
Commit
7ccefc24
authored
Aug 21, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug where #class scanning would error on the Interpolations module
parent
4f9ffb85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
lib/paperclip/interpolations.rb
+4
-1
test/interpolations_test.rb
+4
-0
No files found.
lib/paperclip/interpolations.rb
View file @
7ccefc24
...
...
@@ -63,7 +63,10 @@ module Paperclip
# Returns the underscored, pluralized version of the class name.
# e.g. "users" for the User class.
def
class
attachment
,
style
# NOTE: The arguments need to be optional, because some tools fetch
# all class names. Calling #class will return the expected class.
def
class
attachment
=
nil
,
style
=
nil
return
super
()
if
attachment
.
nil?
&&
style
.
nil?
attachment
.
instance
.
class
.
to_s
.
underscore
.
pluralize
end
...
...
test/interpolations_test.rb
View file @
7ccefc24
...
...
@@ -19,6 +19,10 @@ class InterpolationsTest < Test::Unit::TestCase
assert_equal
RAILS_ENV
,
Paperclip
::
Interpolations
.
rails_env
(
:attachment
,
:style
)
end
should
"return the class of the Interpolations module when called with no params"
do
assert_equal
Module
,
Paperclip
::
Interpolations
.
class
end
should
"return the class of the instance"
do
attachment
=
mock
attachment
.
expects
(
:instance
).
returns
(
attachment
)
...
...
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