Module: MassiveRecord::ORM::Validations

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Validations
Defined in:
lib/massive_record/orm/validations.rb,
lib/massive_record/orm/validations/associated.rb

Defined Under Namespace

Modules: ClassMethods Classes: AssociatedValidator

Instance Method Summary collapse

Instance Method Details

#save(options = {}) ⇒ Object



35
36
37
# File 'lib/massive_record/orm/validations.rb', line 35

def save(options = {})
  perform_validation(options) ? super : false
end

#save!(options = {}) ⇒ Object



39
40
41
# File 'lib/massive_record/orm/validations.rb', line 39

def save!(options = {})
  perform_validation(options) ? super : raise(RecordInvalid.new(self))
end

#valid?(context = nil) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
# File 'lib/massive_record/orm/validations.rb', line 43

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