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
9e71b211
Commit
9e71b211
authored
Jan 23, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the geometry proc running to assignment instead of initialization
parent
f07487f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
lib/paperclip/attachment.rb
+6
-0
test/attachment_test.rb
+13
-2
No files found.
lib/paperclip/attachment.rb
View file @
9e71b211
...
@@ -90,6 +90,7 @@ module Paperclip
...
@@ -90,6 +90,7 @@ module Paperclip
@dirty
=
true
@dirty
=
true
solidify_style_definitions
post_process
if
valid?
post_process
if
valid?
# Reset the file size if the original file was reprocessed.
# Reset the file size if the original file was reprocessed.
...
@@ -303,6 +304,11 @@ module Paperclip
...
@@ -303,6 +304,11 @@ module Paperclip
:convert_options
=>
extra_options_for
(
name
)
:convert_options
=>
extra_options_for
(
name
)
}.
merge
(
@styles
[
name
])
}.
merge
(
@styles
[
name
])
end
end
end
end
def
solidify_style_definitions
#:nodoc:
@styles
.
each
do
|
name
,
args
|
if
@styles
[
name
][
:geometry
].
respond_to?
(
:call
)
if
@styles
[
name
][
:geometry
].
respond_to?
(
:call
)
@styles
[
name
][
:geometry
]
=
@styles
[
name
][
:geometry
].
call
(
instance
)
@styles
[
name
][
:geometry
]
=
@styles
[
name
][
:geometry
].
call
(
instance
)
end
end
...
...
test/attachment_test.rb
View file @
9e71b211
...
@@ -182,8 +182,19 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -182,8 +182,19 @@ class AttachmentTest < Test::Unit::TestCase
@attachment
=
Dummy
.
new
.
avatar
@attachment
=
Dummy
.
new
.
avatar
end
end
should
"have the correct geometry"
do
should
"not run the procs immediately"
do
assert_equal
"50x50#"
,
@attachment
.
styles
[
:normal
][
:geometry
]
assert_kind_of
Proc
,
@attachment
.
styles
[
:normal
][
:geometry
]
end
context
"when assigned"
do
setup
do
@file
=
StringIO
.
new
(
"."
)
@attachment
.
assign
(
@file
)
end
should
"have the correct geometry"
do
assert_equal
"50x50#"
,
@attachment
.
styles
[
:normal
][
:geometry
]
end
end
end
end
end
end
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