Module: Apes::Model
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/apes/model.rb
Overview
Some utility extensions to ActiveModel.
Instance Method Summary (collapse)
-
- (ActiveModel::Errors) additional_errors
A list of manually managed errors for the model.
-
- (ActiveModel::Errors) all_validation_errors
A list of automatically and manually added errors for the model.
-
- (Object) run_validations!
Perform validations on the model and makes sure manually added errors are included.
Instance Method Details
- (ActiveModel::Errors) additional_errors
A list of manually managed errors for the model.
69 70 71 |
# File 'lib/apes/model.rb', line 69 def additional_errors @additional_errors ||= ActiveModel::Errors.new(self) end |
- (ActiveModel::Errors) all_validation_errors
A list of automatically and manually added errors for the model.
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/apes/model.rb', line 82 def all_validation_errors additional_errors.each do |field, error| errors.add(field, error) end errors.each do |field| errors[field].uniq! end errors end |
- (Object) run_validations!
Perform validations on the model and makes sure manually added errors are included.
74 75 76 77 |
# File 'lib/apes/model.rb', line 74 def run_validations! errors..merge!(additional_errors.) super end |