Module: Paperclip::Validators::HelperMethods
- Defined in:
- lib/paperclip/validators/attachment_width_validator.rb,
lib/paperclip/validators/attachment_height_validator.rb
Instance Method Summary collapse
-
#validates_attachment_height(*attr_names) ⇒ Object
Places ActiveRecord-style validations on the pixel height of the file assigned.
-
#validates_attachment_width(*attr_names) ⇒ Object
Places ActiveRecord-style validations on the pixel width of the file assigned.
Instance Method Details
#validates_attachment_height(*attr_names) ⇒ Object
Places ActiveRecord-style validations on the pixel height of the file assigned. The possible options are:
-
in
: a Range of bytes (i.e.1..1.megabyte
), -
less_than
: equivalent to :in => 0..options -
greater_than
: equivalent to :in => options..Infinity -
message
: error message to display, use :min and :max as replacements -
if
: A lambda or name of an instance method. Validation will only be run if this lambda or method returns true. -
unless
: Same asif
but validates if lambda or method returns false.
84 85 86 |
# File 'lib/paperclip/validators/attachment_height_validator.rb', line 84 def (*attr_names) validates_with AttachmentHeightValidator, _merge_attributes(attr_names) end |
#validates_attachment_width(*attr_names) ⇒ Object
Places ActiveRecord-style validations on the pixel width of the file assigned. The possible options are:
-
in
: a Range of bytes (i.e.1..1.megabyte
), -
less_than
: equivalent to :in => 0..options -
greater_than
: equivalent to :in => options..Infinity -
message
: error message to display, use :min and :max as replacements -
if
: A lambda or name of an instance method. Validation will only be run if this lambda or method returns true. -
unless
: Same asif
but validates if lambda or method returns false.
84 85 86 |
# File 'lib/paperclip/validators/attachment_width_validator.rb', line 84 def (*attr_names) validates_with AttachmentWidthValidator, _merge_attributes(attr_names) end |