Sha256: fef556254bb44903ab8dd6339d5d5fa8e89d9384efa0541dff5a0c7f1014b877
Contents?: true
Size: 606 Bytes
Versions: 10
Compression:
Stored size: 606 Bytes
Contents
module Doorkeeper module Validations extend ActiveSupport::Concern attr_accessor :error def validate @error = nil self.class.validations.each do |validation| @error = validation[:options][:error] unless send("validate_#{validation[:attribute]}") break if @error end end def valid? validate @error.nil? end module ClassMethods def validate(attribute, options = {}) validations << { attribute: attribute, options: options } end def validations @validations ||= [] end end end end
Version data entries
10 entries across 10 versions & 1 rubygems