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
6459f2c0
Commit
6459f2c0
authored
Nov 15, 2013
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring of previous commit
parent
9a3f9f8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
lib/paperclip/attachment_registry.rb
+2
-2
test/attachment_registry_test.rb
+5
-8
No files found.
lib/paperclip/attachment_registry.rb
View file @
6459f2c0
...
...
@@ -51,8 +51,8 @@ module Paperclip
end
def
definitions_for
(
klass
)
klass
.
ancestors
.
each_with_object
({})
do
|
k
,
obj
|
obj
.
merge!
@attachments
[
k
]
klass
.
ancestors
.
each_with_object
({})
do
|
ancestor
,
inherited_definitions
|
inherited_definitions
.
merge!
@attachments
[
ancestor
]
end
end
end
...
...
test/attachment_registry_test.rb
View file @
6459f2c0
...
...
@@ -64,15 +64,12 @@ class AttachmentRegistryTest < Test::Unit::TestCase
end
should
"produce defintions for subclasses"
do
expected_definitions
=
{
avatar:
{
yo:
'greeting'
}
}
foo
=
Class
.
new
bar
=
Class
.
new
(
foo
)
Paperclip
::
AttachmentRegistry
.
register
(
foo
,
:avatar
,
{
yo:
'greeting'
})
expected_definitions
=
{
avatar:
{
yo:
'greeting'
}
}
Foo
=
Class
.
new
Bar
=
Class
.
new
(
Foo
)
Paperclip
::
AttachmentRegistry
.
register
(
Foo
,
:avatar
,
expected_definitions
[
:avatar
])
definitions
=
Paperclip
::
AttachmentRegistry
.
definitions_for
(
b
ar
)
definitions
=
Paperclip
::
AttachmentRegistry
.
definitions_for
(
B
ar
)
assert_equal
expected_definitions
,
definitions
end
...
...
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