Module: MemModel::Validations

Extended by:
Concern
Defined in:
lib/mem_model/validations.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Concern

append_features, extended, included

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/mem_model/validations.rb', line 15

def valid?
  validations.empty? || validations.all? do |kind, attr|
    value = self.send(attr)
    value && value != ''
  end
end

#validationsObject



22
23
24
# File 'lib/mem_model/validations.rb', line 22

def validations
  self.class.validations
end