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
ece46f46
Commit
ece46f46
authored
Mar 23, 2015
by
Arjun Anand
Committed by
Jon Yurek
Aug 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
styling tweaks
parent
17ecc58a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
lib/paperclip/has_attached_file.rb
+3
-1
spec/paperclip/has_attached_file_spec.rb
+7
-6
No files found.
lib/paperclip/has_attached_file.rb
View file @
ece46f46
...
...
@@ -92,7 +92,9 @@ module Paperclip
@klass
.
send
(
:after_save
)
{
send
(
name
).
send
(
:save
)
}
@klass
.
send
(
:before_destroy
)
{
send
(
name
).
send
(
:queue_all_for_delete
)
}
if
@klass
.
respond_to?
(
:after_commit
)
@klass
.
send
(
:after_commit
,
:on
=>
:destroy
)
{
send
(
name
).
send
(
:flush_deletes
)
}
@klass
.
send
(
:after_commit
,
on: :destroy
)
do
send
(
name
).
send
(
:flush_deletes
)
end
else
@klass
.
send
(
:after_destroy
)
{
send
(
name
).
send
(
:flush_deletes
)
}
end
...
...
spec/paperclip/has_attached_file_spec.rb
View file @
ece46f46
...
...
@@ -38,12 +38,13 @@ describe Paperclip::HasAttachedFile do
assert_adding_attachment
(
'avatar'
).
defines_callback
(
'after_commit'
)
end
it
'defines an after_commit callback if the class allows after_commit callbacks'
do
assert_adding_attachment
(
'avatar'
).
defines_callback
(
'after_commit'
)
end
it
'defines an after_destroy callback if the class does not allow after_commit callbacks'
do
assert_adding_attachment
(
'avatar'
,
:unstub_methods
=>
[
:after_commit
]).
defines_callback
(
'after_destroy'
)
context
'when the class does not allow after_commit callbacks'
do
it
'defines an after_destroy callback'
do
assert_adding_attachment
(
'avatar'
,
unstub_methods:
[
:after_commit
]
).
defines_callback
(
'after_destroy'
)
end
end
it
'defines the Paperclip-specific callbacks'
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