Sha256: b70af5a8ece706480ca28d610e5d92a23c071d8a30a818eb9358d3666d9608a3

Contents?: true

Size: 642 Bytes

Versions: 8

Compression:

Stored size: 642 Bytes

Contents

require 'active_model'
require 'golden_fleece/validations/active_model/fleece_schema_conformance_validator'

module GoldenFleece
  module Model
    module ActiveModel
      module Validation
        def self.included(base)
          base.class_eval do
            validate_attributes = -> fleece_context {
              fleece_context.model_class.class_eval do
                validates *fleece_context.attributes, 'GoldenFleece::Validations::ActiveModel::FleeceSchemaConformance' => true
              end
            }

            fleece_context.setup_callbacks << validate_attributes
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
golden_fleece-1.0.1 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-1.0.0 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.5 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.4 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.3 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.2 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.1 lib/golden_fleece/model/active_model/validation.rb
golden_fleece-0.1.0 lib/golden_fleece/model/active_model/validation.rb