Module: CouchPotato::Validation::WithActiveModel

Defined in:
lib/couch_potato/validation/with_active_model.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/couch_potato/validation/with_active_model.rb', line 4

def self.included(base)
  require 'active_model'
  require 'active_model/translation'
  base.send :include, ::ActiveModel::Validations
  base.instance_eval do
    def before_validation(*names)
      names.each do |name|
        validate name
      end
    end
  end
end