Module: ClientSideValidations::ActiveModel::Validator

Defined in:
lib/client_side_validations/active_model.rb

Instance Method Summary collapse

Instance Method Details

#client_side_hash(model, attribute) ⇒ Object



6
7
8
9
# File 'lib/client_side_validations/active_model.rb', line 6

def client_side_hash(model, attribute)
  options = self.options.dup
  { :message => model.errors.generate_message(attribute, message_type, options) }.merge(options.except(*::ActiveModel::Errors::CALLBACKS_OPTIONS - [:allow_blank, :if, :unless]))
end

#copy_conditional_attributes(to, from) ⇒ Object



11
12
13
# File 'lib/client_side_validations/active_model.rb', line 11

def copy_conditional_attributes(to, from)
  [:if, :unless].each { |key| to[key] = from[key] if from[key].present? }
end