paperclip
https://github.com/thoughtbot/paperclip
Ruby
Easy file attachment management for ActiveRecord
Paperclip::Validators::HelperMethods#validates_attachment_size
Places ActiveModel validations on the size 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[:less_than] * +greater_than+: equivalent to :in => options[:greater_than]..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 as +if+ but validates if lambda or method returns false.
Edit
git clone [email protected]:thoughtbot/paperclip.git
cd paperclip
open lib/paperclip/validators/attachment_size_validator.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Paperclip--Validators--HelperMethods-validates_attachment_size-for-pr
# Commit to gitgit add lib/paperclip/validators/attachment_size_validator.rbgit commit -m "better docs for Paperclip::Validators::HelperMethods#validates_attachment_size"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Paperclip--Validators--HelperMethods-validates_attachment_size-for-pr
hub pull-request
# Celebrate!