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