paperclip
https://github.com/thoughtbot/paperclip
Ruby
Easy file attachment management for ActiveRecord
Paperclip::Validators::ClassMethods#validates_attachment
This method is a shortcut to validator classes that is in
"Attachment...Validator" format. It is almost the same thing as the
+validates+ method that shipped with Rails, but this is customized to
be using with attachment validators. This is helpful when you're using
multiple attachment validators on a single attachment.
Example of using the validator:
validates_attachment :avatar, :presence => true,
:content_type => { :content_type => "image/jpg" },
:size => { :in => 0..10.kilobytes }Edit
git clone [email protected]:thoughtbot/paperclip.git
cd paperclip
open lib/paperclip/validators.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Paperclip--Validators--ClassMethods-validates_attachment-for-pr
# Commit to gitgit add lib/paperclip/validators.rbgit commit -m "better docs for Paperclip::Validators::ClassMethods#validates_attachment"
# 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--ClassMethods-validates_attachment-for-pr
hub pull-request
# Celebrate!