module ClientSideValidations::ActiveModel::EnumerableValidator

Public Instance Methods

client_side_hash(model, attribute, force = nil) click to toggle source
# File lib/client_side_validations/active_model.rb, line 169
def client_side_hash(model, attribute, force = nil)
  options = self.options.dup

  if options[:in].respond_to?(:call)
    return unless force

    options[:in] = options[:in].call(model)
  end

  hash = build_client_side_hash(model, attribute, options)

  if hash[:in].is_a?(Range)
    hash[:range] = hash[:in]
    hash.delete(:in)
  end

  hash
end