Module: MarkMapper::Plugins::Validations

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Validations, ActiveModel::Validations::Callbacks
Included in:
Document, EmbeddedDocument
Defined in:
lib/mark_mapper/plugins/validations.rb

Defined Under Namespace

Modules: ClassMethods Classes: AssociatedValidator, UniquenessValidator

Instance Method Summary collapse

Instance Method Details

#save(options = {}) ⇒ Object


20
21
22
23
# File 'lib/mark_mapper/plugins/validations.rb', line 20

def save(options = {})
  options = options.reverse_merge(:validate => true)
  !options[:validate] || valid? ? super : false
end

#valid?(context = nil) ⇒ Boolean

Returns:


25
26
27
28
# File 'lib/mark_mapper/plugins/validations.rb', line 25

def valid?(context = nil)
  context ||= (new_record? ? :create : :update)
  super(context)
end