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
b4ff2c57
Commit
b4ff2c57
authored
Dec 12, 2011
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show warning if :class exists in the interpolation URL
This fixes #660
parent
3e209072
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
lib/paperclip.rb
+1
-1
test/paperclip_test.rb
+10
-0
No files found.
lib/paperclip.rb
View file @
b4ff2c57
...
@@ -193,7 +193,7 @@ module Paperclip
...
@@ -193,7 +193,7 @@ module Paperclip
def
check_for_url_clash
(
name
,
url
,
klass
)
def
check_for_url_clash
(
name
,
url
,
klass
)
@names_url
||=
{}
@names_url
||=
{}
default_url
=
url
||
Attachment
.
default_options
[
:url
]
default_url
=
url
||
Attachment
.
default_options
[
:url
]
if
@names_url
[
name
]
&&
@names_url
[
name
][
:url
]
==
default_url
&&
@names_url
[
name
][
:class
]
!=
klass
if
@names_url
[
name
]
&&
@names_url
[
name
][
:url
]
==
default_url
&&
@names_url
[
name
][
:class
]
!=
klass
&&
@names_url
[
name
][
:url
]
!~
/:class/
log
(
"Duplicate URL for
#{
name
}
with
#{
default_url
}
. This will clash with attachment defined in
#{
@names_url
[
name
][
:class
]
}
class"
)
log
(
"Duplicate URL for
#{
name
}
with
#{
default_url
}
. This will clash with attachment defined in
#{
@names_url
[
name
][
:class
]
}
class"
)
end
end
@names_url
[
name
]
=
{
:url
=>
default_url
,
:class
=>
klass
}
@names_url
[
name
]
=
{
:url
=>
default_url
,
:class
=>
klass
}
...
...
test/paperclip_test.rb
View file @
b4ff2c57
...
@@ -86,6 +86,16 @@ class PaperclipTest < Test::Unit::TestCase
...
@@ -86,6 +86,16 @@ class PaperclipTest < Test::Unit::TestCase
has_attached_file
:blah
has_attached_file
:blah
end
end
end
end
should
"not generate warning if attachment is redifined with the same url string but has :class in it"
do
Paperclip
.
expects
(
:log
).
never
Dummy
.
class_eval
do
has_attached_file
:blah
,
:url
=>
"/system/:class/:attachment/:id/:style/:filename"
end
Dummy2
.
class_eval
do
has_attached_file
:blah
,
:url
=>
"/system/:class/:attachment/:id/:style/:filename"
end
end
end
end
context
"An ActiveRecord model with an 'avatar' attachment"
do
context
"An ActiveRecord model with an 'avatar' attachment"
do
...
...
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