Module: ActiveGroonga::Validations — activegroonga - Ranguba

Module: ActiveGroonga::Validations

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Validations
Included in:
Base
Defined in:
lib/active_groonga/validations.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary (collapse)

Instance Method Details

- (Object) save(options = {})



52
53
54
# File 'lib/active_groonga/validations.rb', line 52

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

- (Object) save!(options = {})



56
57
58
# File 'lib/active_groonga/validations.rb', line 56

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

- (Boolean) valid?(context = nil)

Returns:

  • (Boolean)


60
61
62
63
64
# File 'lib/active_groonga/validations.rb', line 60

def valid?(context=nil)
  context ||= (new_record? ? :create : :update)
  valid = super(context)
  errors.empty? and valid
end