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
84a01174
Commit
84a01174
authored
May 04, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove more obsolete Ruby/Rails checking code
parent
a6c86832
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
lib/paperclip/helpers.rb
+4
-16
No files found.
lib/paperclip/helpers.rb
View file @
84a01174
...
...
@@ -32,26 +32,14 @@ module Paperclip
# Find all instances of the given Active Record model +klass+ with attachment +name+.
# This method is used by the refresh rake tasks.
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_each
(
:conditions
=>
"
#{
name
}
_file_name is not null"
)
do
|
instance
|
yield
(
instance
)
end
class_for
(
klass
).
unscoped
.
where
(
"
#{
name
}
_file_name IS NOT NULL"
).
find_each
do
|
instance
|
yield
(
instance
)
end
end
def
class_for
(
class_name
)
# Ruby 1.9 introduces an inherit argument for Module#const_get and
# #const_defined? and changes their default behavior.
# https://github.com/rails/rails/blob/v3.0.9/activesupport/lib/active_support/inflector/methods.rb#L89
if
Module
.
method
(
:const_get
).
arity
==
1
class_name
.
split
(
'::'
).
inject
(
Object
)
do
|
klass
,
partial_class_name
|
klass
.
const_defined?
(
partial_class_name
)
?
klass
.
const_get
(
partial_class_name
)
:
klass
.
const_missing
(
partial_class_name
)
end
else
class_name
.
split
(
'::'
).
inject
(
Object
)
do
|
klass
,
partial_class_name
|
klass
.
const_defined?
(
partial_class_name
)
?
klass
.
const_get
(
partial_class_name
,
false
)
:
klass
.
const_missing
(
partial_class_name
)
end
class_name
.
split
(
'::'
).
inject
(
Object
)
do
|
klass
,
partial_class_name
|
klass
.
const_defined?
(
partial_class_name
)
?
klass
.
const_get
(
partial_class_name
,
false
)
:
klass
.
const_missing
(
partial_class_name
)
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