module Shrine::Plugins::Validation::AttacherClassMethods

  1. lib/shrine/plugins/validation.rb

Methods

Public Instance

  1. validate

Public Instance methods

validate(&block)

Block that is executed in context of Shrine::Attacher during validation. Example:

Shrine::Attacher.validate do
  if file.size > 5*1024*1024
    errors << "is too big (max is 5 MB)"
  end
end
[show source]
   # File lib/shrine/plugins/validation.rb
16 def validate(&block)
17   private define_method(:validate_block, &block)
18 end