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
16d59f99
Commit
16d59f99
authored
Jan 05, 2012
by
Alexey Mahotkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewording comments
parent
c34a9fb6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
lib/paperclip.rb
+9
-9
No files found.
lib/paperclip.rb
View file @
16d59f99
...
@@ -49,7 +49,7 @@ require 'cocaine'
...
@@ -49,7 +49,7 @@ require 'cocaine'
module
Paperclip
module
Paperclip
class
<<
self
class
<<
self
# Provides configurability to Paperclip. The
re are a number of options available, such as
:
# Provides configurability to Paperclip. The
options available are
:
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
# an uploaded image. Defaults to true.
# an uploaded image. Defaults to true.
# * log: Logs progress to the Rails log. Uses ActiveRecord's logger, so honors
# * log: Logs progress to the Rails log. Uses ActiveRecord's logger, so honors
...
@@ -179,9 +179,9 @@ module Paperclip
...
@@ -179,9 +179,9 @@ module Paperclip
end
end
end
end
rescue
ArgumentError
=>
e
rescue
ArgumentError
=>
e
# Sadly, we need to capture Argu
e
mentError here because Rails 2.3.x
# Sadly, we need to capture ArgumentError here because Rails 2.3.x
# Active
Support dependency's
management will try to the constant inherited
# Active
Support dependency
management will try to the constant inherited
# from Object, and fail misably with "Object is not missing constant X" error
# from Object, and fail mis
er
ably with "Object is not missing constant X" error
# https://github.com/rails/rails/blob/v2.3.12/activesupport/lib/active_support/dependencies.rb#L124
# https://github.com/rails/rails/blob/v2.3.12/activesupport/lib/active_support/dependencies.rb#L124
if
e
.
message
=~
/is not missing constant/
if
e
.
message
=~
/is not missing constant/
raise
NameError
,
"uninitialized constant
#{
class_name
}
"
raise
NameError
,
"uninitialized constant
#{
class_name
}
"
...
@@ -360,8 +360,8 @@ module Paperclip
...
@@ -360,8 +360,8 @@ module Paperclip
# * +less_than+: equivalent to :in => 0..options[:less_than]
# * +less_than+: equivalent to :in => 0..options[:less_than]
# * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
# * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
# * +message+: error message to display, use :min and :max as replacements
# * +message+: error message to display, use :min and :max as replacements
# * +if+: A lambda or name of a
method on the instance
. Validation will only
# * +if+: A lambda or name of a
n instance method
. Validation will only
# be run i
s
this lambda or method returns true.
# be run i
f
this lambda or method returns true.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
def
validates_attachment_size
name
,
options
=
{}
def
validates_attachment_size
name
,
options
=
{}
min
=
options
[
:greater_than
]
||
(
options
[
:in
]
&&
options
[
:in
].
first
)
||
0
min
=
options
[
:greater_than
]
||
(
options
[
:in
]
&&
options
[
:in
].
first
)
||
0
...
@@ -389,7 +389,7 @@ module Paperclip
...
@@ -389,7 +389,7 @@ module Paperclip
# Places ActiveRecord-style validations on the presence of a file.
# Places ActiveRecord-style validations on the presence of a file.
# Options:
# Options:
# * +if+: A lambda or name of a
method on the instance
. Validation will only
# * +if+: A lambda or name of a
n instance method
. Validation will only
# be run if this lambda or method returns true.
# be run if this lambda or method returns true.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
def
validates_attachment_presence
name
,
options
=
{}
def
validates_attachment_presence
name
,
options
=
{}
...
@@ -408,13 +408,13 @@ module Paperclip
...
@@ -408,13 +408,13 @@ module Paperclip
# assigned. The possible options are:
# assigned. The possible options are:
# * +content_type+: Allowed content types. Can be a single content type
# * +content_type+: Allowed content types. Can be a single content type
# or an array. Each type can be a String or a Regexp. It should be
# or an array. Each type can be a String or a Regexp. It should be
# noted that Internet Explorer upload files with content_types that you
# noted that Internet Explorer upload
s
files with content_types that you
# may not expect. For example, JPEG images are given image/pjpeg and
# may not expect. For example, JPEG images are given image/pjpeg and
# PNGs are image/x-png, so keep that in mind when determining how you
# PNGs are image/x-png, so keep that in mind when determining how you
# match. Allows all by default.
# match. Allows all by default.
# * +message+: The message to display when the uploaded file has an invalid
# * +message+: The message to display when the uploaded file has an invalid
# content type.
# content type.
# * +if+: A lambda or name of a
method on the instance
. Validation will only
# * +if+: A lambda or name of a
n instance method
. Validation will only
# be run is this lambda or method returns true.
# be run is this lambda or method returns true.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
# NOTE: If you do not specify an [attachment]_content_type field on your
# NOTE: If you do not specify an [attachment]_content_type field on your
...
...
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