paperclip
https://github.com/thoughtbot/paperclip
Ruby
Easy file attachment management for ActiveRecord
Paperclip::Validators::HelperMethods#validates_attachment_file_name
Places ActiveModel validations on the name of the file assigned. The possible options are: * +matches+: Allowed filename patterns as Regexps. Can be a single one or an array. * +not+: Forbidden file name patterns, specified the same was as +matches+. * +message+: The message to display when the uploaded file has an invalid name. * +if+: A lambda or name of an instance method. Validation will only be run is 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_file_name_validator.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Paperclip--Validators--HelperMethods-validates_attachment_file_name-for-pr
# Commit to gitgit add lib/paperclip/validators/attachment_file_name_validator.rbgit commit -m "better docs for Paperclip::Validators::HelperMethods#validates_attachment_file_name"
# 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_file_name-for-pr
hub pull-request
# Celebrate!