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
2ba27691
Commit
2ba27691
authored
May 03, 2013
by
Mike Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the before_destroy callback out
parent
56a2cd69
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletions
+5
-1
lib/paperclip.rb
+0
-1
lib/paperclip/has_attached_file.rb
+1
-0
test/has_attached_file_test.rb
+4
-0
No files found.
lib/paperclip.rb
View file @
2ba27691
...
...
@@ -175,7 +175,6 @@ module Paperclip
def
has_attached_file
(
name
,
options
=
{})
HasAttachedFile
.
define_on
(
self
,
name
,
options
)
before_destroy
{
send
(
name
).
send
(
:queue_all_for_delete
)
}
after_destroy
{
send
(
name
).
send
(
:flush_deletes
)
}
define_paperclip_callbacks
:post_process
,
:"
#{
name
}
_post_process"
...
...
lib/paperclip/has_attached_file.rb
View file @
2ba27691
...
...
@@ -72,6 +72,7 @@ module Paperclip
def
add_active_record_callbacks
name
=
@name
@klass
.
send
(
:after_save
)
{
send
(
name
).
send
(
:save
)
}
@klass
.
send
(
:before_destroy
)
{
send
(
name
).
send
(
:queue_all_for_delete
)
}
end
end
end
test/has_attached_file_test.rb
View file @
2ba27691
...
...
@@ -26,6 +26,10 @@ class HasAttachedFileTest < Test::Unit::TestCase
should
'define an after_save callback'
do
assert_adding_attachment
(
'avatar'
).
defines_callback
(
'after_save'
)
end
should
'define a before_destroy callback'
do
assert_adding_attachment
(
'avatar'
).
defines_callback
(
'before_destroy'
)
end
end
private
...
...
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