Module: CouchPotato::Validation

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

Defined Under Namespace

Modules: WithActiveModel, WithValidatable

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



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

def self.included(base) #:nodoc:
  case CouchPotato::Config.validation_framework
  when :validatable
    require 'couch_potato/validation/with_validatable'
    base.send :include, CouchPotato::Validation::WithValidatable
  when :active_model
    require 'couch_potato/validation/with_active_model'
    base.send :include, CouchPotato::Validation::WithActiveModel
  else
    raise "Unknown CouchPotato::Config.validation_framework #{CouchPotato::Config.validation_framework.inspect}, options are :validatable or :active_model"
  end
end