Module: NoBrainer::Document::Validation::Core
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations, ActiveModel::Validations::Callbacks
- Defined in:
- lib/no_brainer/document/validation/core.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- SHORTHANDS =
{ :format => :format, :length => :length, :required => :presence, :uniq => :uniqueness, :unique => :uniqueness, :in => :inclusion }
Instance Method Summary collapse
Instance Method Details
#save?(options = {}) ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/no_brainer/document/validation/core.rb', line 15 def save?(={}) = { :validate => true }.merge() if [:validate] valid? ? super : false else super end end |
#valid?(context = nil, options = {}) ⇒ Boolean
11 12 13 |
# File 'lib/no_brainer/document/validation/core.rb', line 11 def valid?(context=nil, ={}) super(context || (new_record? ? :create : :update)) end |