Sha256: 7f2800045d18e50944c94a7db64e79041ed3d07e48e44dea3c4261a86a3e49b2

Contents?: true

Size: 402 Bytes

Versions: 69

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

69 entries across 69 versions & 1 rubygems

Version Path
plutonium-0.19.2 lib/active_model/validations/attached_validator.rb
plutonium-0.19.1 lib/active_model/validations/attached_validator.rb
plutonium-0.19.0 lib/active_model/validations/attached_validator.rb
plutonium-0.18.8 lib/active_model/validations/attached_validator.rb
plutonium-0.18.7 lib/active_model/validations/attached_validator.rb
plutonium-0.18.6 lib/active_model/validations/attached_validator.rb
plutonium-0.18.5 lib/active_model/validations/attached_validator.rb
plutonium-0.18.4 lib/active_model/validations/attached_validator.rb
plutonium-0.18.3 lib/active_model/validations/attached_validator.rb
plutonium-0.18.2 lib/active_model/validations/attached_validator.rb
plutonium-0.18.1 lib/active_model/validations/attached_validator.rb
plutonium-0.18.0 lib/active_model/validations/attached_validator.rb
plutonium-0.16.5 lib/active_model/validations/attached_validator.rb
plutonium-0.16.4 lib/active_model/validations/attached_validator.rb
plutonium-0.16.3 lib/active_model/validations/attached_validator.rb
plutonium-0.16.1 lib/active_model/validations/attached_validator.rb
plutonium-0.16.0 lib/active_model/validations/attached_validator.rb
plutonium-0.15.24 lib/active_model/validations/attached_validator.rb
plutonium-0.15.23 lib/active_model/validations/attached_validator.rb
plutonium-0.15.22 lib/active_model/validations/attached_validator.rb