Sha256: ea582034e8d7c78a4a081e85bb1007e83d82af706ea8c547763c4f2bfb3b2c06

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

module BootstrapValidatorRails
  module Validators
    class Presence
      def initialize(record, method, validator)
        @record, @method, @validator = record, method, @validator
      end

      def generate_data
        data = {}
        data[:bv_notempty] = 'true'
        data[:bv_notempty_message] = generate_message
        data
      end

      def generate_message
        @record.errors.generate_message(@method, :blank, default: "can't be blank")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_validator_rails-0.4.1 lib/bootstrap_validator_rails/validators/presence_validator.rb
bootstrap_validator_rails-0.4.0 lib/bootstrap_validator_rails/validators/presence_validator.rb