Sha256: a1d9840a8290cb68160f61e1a85bb19a5c410bee893aa381128e3c5c53686348

Contents?: true

Size: 567 Bytes

Versions: 30

Compression:

Stored size: 567 Bytes

Contents

module CouchPotato
  module Validation
    module WithActiveModel
      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
    end
  end
end

# provide same interface to errors object as in Validatable
module ::ActiveModel
  class Errors
    def errors
      self
    end
  end
end

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
couch_potato-0.6.0 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.7 lib/couch_potato/validation/with_active_model.rb
couch_potato-rails2-0.5.10 lib/couch_potato/validation/with_active_model.rb
couch_potato-rails2-0.5.9 lib/couch_potato/validation/with_active_model.rb
couch_potato-rails2-0.5.8 lib/couch_potato/validation/with_active_model.rb
couch_potato-rails2-0.5.7 lib/couch_potato/validation/with_active_model.rb
couch_potato-rails2-0.5.6 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.6 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.5 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.4 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.3 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.2 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.1 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.5.0 lib/couch_potato/validation/with_active_model.rb
davber_couch_potato-0.4.0 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.4.0 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.3.2 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.3.1 lib/couch_potato/validation/with_active_model.rb
davber_couch_potato-0.3.0 lib/couch_potato/validation/with_active_model.rb
couch_potato-0.3.0 lib/couch_potato/validation/with_active_model.rb