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
9a9c9ab7
Commit
9a9c9ab7
authored
Feb 16, 2013
by
printercu
Committed by
Jon Yurek
Feb 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mark instance as changed after assigning new file
parent
dcd2774e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
lib/paperclip/attachment.rb
+2
-0
test/attachment_test.rb
+7
-0
No files found.
lib/paperclip/attachment.rb
View file @
9a9c9ab7
...
@@ -110,6 +110,8 @@ module Paperclip
...
@@ -110,6 +110,8 @@ module Paperclip
# Reset the file size if the original file was reprocessed.
# Reset the file size if the original file was reprocessed.
instance_write
(
:file_size
,
@queued_for_write
[
:original
].
size
)
instance_write
(
:file_size
,
@queued_for_write
[
:original
].
size
)
instance_write
(
:fingerprint
,
@queued_for_write
[
:original
].
fingerprint
)
if
instance_respond_to?
(
:fingerprint
)
instance_write
(
:fingerprint
,
@queued_for_write
[
:original
].
fingerprint
)
if
instance_respond_to?
(
:fingerprint
)
updater
=
:"
#{
name
}
_file_name_will_change!"
instance
.
send
updater
if
instance
.
respond_to?
updater
end
end
# Returns the public URL of the attachment with a given style. This does
# Returns the public URL of the attachment with a given style. This does
...
...
test/attachment_test.rb
View file @
9a9c9ab7
...
@@ -1207,6 +1207,13 @@ class AttachmentTest < Test::Unit::TestCase
...
@@ -1207,6 +1207,13 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
creation
.
to_i
,
@dummy
.
avatar
.
created_at
assert_equal
creation
.
to_i
,
@dummy
.
avatar
.
created_at
assert_not_equal
now
.
to_i
,
@dummy
.
avatar
.
created_at
assert_not_equal
now
.
to_i
,
@dummy
.
avatar
.
created_at
end
end
should
"set changed? to true on attachment assignment"
do
@dummy
.
avatar
=
@file
@dummy
.
save!
@dummy
.
avatar
=
@file
assert
@dummy
.
changed?
end
end
end
context
"and avatar_updated_at column"
do
context
"and avatar_updated_at column"
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