Module: CouchPotato::Validation::WithValidatable
- Defined in:
- lib/couch_potato/validation/with_validatable.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/couch_potato/validation/with_validatable.rb', line 4 def self.included(base) require 'validatable' 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 |