Sha256: c5f242b267b006aed8232d532434fe0143227035a4c8dea881da0efe55c4f19b

Contents?: true

Size: 476 Bytes

Versions: 5

Compression:

Stored size: 476 Bytes

Contents

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

      def generate_data
        {
          :bv_notempty => '',
          :bv_notempty_message => generate_message
        }
      end

      def generate_message
        @record.errors.generate_message(@method, :presence, {default: 'cannot be blank'})
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bootstrap_validator_rails-0.3.0 lib/bootstrap_validator_rails/validators/presence_validator.rb
bootstrap_validator_rails-0.2.0 lib/bootstrap_validator_rails/validators/presence_validator.rb
bootstrap_validator_rails-0.1.2 lib/bootstrap_validator_rails/validators/presence_validator.rb
bootstrap_validator_rails-0.1.1 lib/bootstrap_validator_rails/validators/presence_validator.rb
bootstrap_validator_rails-0.1.0 lib/bootstrap_validator_rails/validators/presence_validator.rb