Sha256: 0e676de595ab143d0991efdef6d8a844f2123924a0b6c59df4647a8ea06aa3e7
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module BootstrapValidatorRails module Validators class Length < Validator def generate_data data = {} return data if unsupported? options = validator_options data[:bv_stringlength] = 'true' if options[:minimum] data[:bv_stringlength_min] = options[:minimum] end if options[:maximum] data[:bv_stringlength_max] = options[:maximum] end if options[:is] data[:bv_stringlength_minimum] = options[:is] data[:bv_stringlength_maximum] = options[:is] data[:bv_stringlength_message] = @record.errors.generate_message(@method) end data end def generate_object options = @validator.options data = {} data["stringLength"] = {} if options[:minimum] data["stringLength"]["min"] = options[:minimum] end if options[:maximum] data["stringLength"]["max"] = options[:maximum] end if options[:is] data["stringLength"]["min"] = options[:is] data["stringLength"]["max"] = options[:is] data["stringLength"]['message'] = @record.errors.generate_message(@method) end {method_key => {validators: data}} end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_validator_rails-0.6.0 | lib/bootstrap_validator_rails/validators/length_validator.rb |