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
0e8b874c
Commit
0e8b874c
authored
Nov 18, 2011
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use #unscoped or #with_exclusive_scope when selecting records for the rake task
parent
16d06c4a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
lib/paperclip.rb
+3
-0
No files found.
lib/paperclip.rb
View file @
0e8b874c
...
@@ -140,10 +140,13 @@ module Paperclip
...
@@ -140,10 +140,13 @@ module Paperclip
# Find all instances of the given Active Record model +klass+ with attachment +name+.
# Find all instances of the given Active Record model +klass+ with attachment +name+.
# This method is used by the refresh rake tasks.
# This method is used by the refresh rake tasks.
def
each_instance_with_attachment
(
klass
,
name
)
def
each_instance_with_attachment
(
klass
,
name
)
unscope_method
=
class_for
(
klass
).
respond_to?
(
:unscoped
)
?
:
unscoped
:
:with_exclusive_scope
class_for
(
klass
).
send
(
unscope_method
)
do
class_for
(
klass
).
find
(
:all
,
:order
=>
'id'
).
each
do
|
instance
|
class_for
(
klass
).
find
(
:all
,
:order
=>
'id'
).
each
do
|
instance
|
yield
(
instance
)
if
instance
.
send
(
:"
#{
name
}
?"
)
yield
(
instance
)
if
instance
.
send
(
:"
#{
name
}
?"
)
end
end
end
end
end
# Log a paperclip-specific line. This will logs to STDOUT
# Log a paperclip-specific line. This will logs to STDOUT
# by default. Set Paperclip.options[:log] to false to turn off.
# by default. Set Paperclip.options[:log] to false to turn off.
...
...
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