Module: Shrine::Plugins::Lotus::AttachmentMethods

Defined in:
lib/shrine/plugins/lotus.rb

Instance Method Summary collapse

Instance Method Details

#initialize(name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shrine/plugins/lotus.rb', line 11

def initialize(name)
  super

  if shrine_class.opts[:lotus_validations]
    module_eval <<-RUBY, __FILE__, __LINE__ + 1
      def validate
        super
        #{name}_attacher.errors.each do |message|
          errors.add(:#{name}, message)
        end
      end
    RUBY
  end
end