Module: ClientSideValidations::ActiveModel::EnumerableValidator

Included in:
Exclusion, Inclusion
Defined in:
lib/client_side_validations/active_model.rb

Instance Method Summary collapse

Instance Method Details

#client_side_hash(model, attribute, force = nil) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/client_side_validations/active_model.rb', line 177

def client_side_hash(model, attribute, force = nil)
  options = self.options.dup

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

    options[:in] = resolve_proc(options[:in], 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