Sha256: 7f2800045d18e50944c94a7db64e79041ed3d07e48e44dea3c4261a86a3e49b2

Contents?: true

Size: 402 Bytes

Versions: 50

Compression:

Stored size: 402 Bytes

Contents

require "active_model"

module ActiveModel
  module Validations
    # Validates that a file is attached
    #
    # Example:
    #
    #   validates :logo, attached: true
    #
    class AttachedValidator < EachValidator
      def validate_each(record, attribute, value)
        record.errors.add(attribute, (options[:message] || "must be attached")) unless value.attached?
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
plutonium-0.15.2 lib/active_model/validations/attached_validator.rb
plutonium-0.15.1 lib/active_model/validations/attached_validator.rb
plutonium-0.15.0 lib/active_model/validations/attached_validator.rb
plutonium-0.15.0.pre.rc3 lib/active_model/validations/attached_validator.rb
plutonium-0.15.0.pre.rc2 lib/active_model/validations/attached_validator.rb
plutonium-0.15.0.pre.rc1 lib/active_model/validations/attached_validator.rb
plutonium-0.14.1 lib/active_model/validations/attached_validator.rb
plutonium-0.14.0 lib/active_model/validations/attached_validator.rb
plutonium-0.13.3 lib/active_model/validations/attached_validator.rb
plutonium-0.13.2 lib/active_model/validations/attached_validator.rb
plutonium-0.13.1 lib/active_model/validations/attached_validator.rb
plutonium-0.13.0 lib/active_model/validations/attached_validator.rb
plutonium-0.12.14 lib/active_model/validations/attached_validator.rb
plutonium-0.12.13 lib/active_model/validations/attached_validator.rb
plutonium-0.12.12 lib/active_model/validations/attached_validator.rb
plutonium-0.12.11 lib/active_model/validations/attached_validator.rb
plutonium-0.12.10 lib/active_model/validations/attached_validator.rb
plutonium-0.12.9 lib/active_model/validations/attached_validator.rb
plutonium-0.12.8 lib/active_model/validations/attached_validator.rb
plutonium-0.12.7 lib/active_model/validations/attached_validator.rb