Sha256: b6ca5d0b43b5a3827ea5e375863c6f6c894b6c8995bafdb81e5b1fb8d3c3e3bf

Contents?: true

Size: 617 Bytes

Versions: 4

Compression:

Stored size: 617 Bytes

Contents

module Granite
  module Form
    module Model
      module Validations
        extend ActiveSupport::Concern
        include ActiveModel::Validations

        included do
          extend HelperMethods
          include HelperMethods

          alias_method :validate, :valid?
        end

        def validate!(context = nil)
          valid?(context) || raise_validation_error
        end

      protected

        def raise_validation_error
          raise Granite::Form::ValidationError, self
        end
      end
    end
  end
end

Dir[File.dirname(__FILE__) + '/validations/*.rb'].each { |file| require file }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
granite-form-0.3.0 lib/granite/form/model/validations.rb
granite-form-0.2.0 lib/granite/form/model/validations.rb
granite-form-0.1.1 lib/granite/form/model/validations.rb
granite-form-0.1.0 lib/granite/form/model/validations.rb