Module: Elastictastic::Validations

Extended by:
ActiveSupport::Concern
Defined in:
lib/elastictastic/validations.rb

Defined Under Namespace

Modules: ClassMethods Classes: NestedValidator

Instance Method Summary collapse

Instance Method Details

#save(options = {}) ⇒ Object


18
19
20
21
22
23
24
25
# File 'lib/elastictastic/validations.rb', line 18

def save(options = {})
  if options[:validate] == false || valid?
    super
    true
  else
    false
  end
end

#save!Object


27
28
29
30
31
32
# File 'lib/elastictastic/validations.rb', line 27

def save!
  if !save
    raise Elastictastic::RecordInvalid, errors.full_messages.to_sentence
  end
  self
end