Sha256: cf1fd70ddce539acf4ef21225fc165bb07d361dc378765b5373eb287dc6eb447
Contents?: true
Size: 602 Bytes
Versions: 1
Compression:
Stored size: 602 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? validate @error.nil? end module ClassMethods def validate(attribute, options = {}) validations << [attribute, options[:error]] end def validations @validations ||= [] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
couchkeeper-0.6.7 | lib/doorkeeper/validations.rb |