Module: CouchPotato::Persistence::Validation
- Defined in:
- lib/couch_potato/persistence/validation.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/couch_potato/persistence/validation.rb', line 6 def self.included(base) base.send :include, Validatable base.class_eval do # Override the validate method to first run before_validation callback def valid? errors.clear run_callbacks :before_validation before_validation_errors = errors.errors.dup super before_validation_errors.each do |k, v| v.each {|| errors.add(k, )} end errors.empty? end end end |