module Doorkeeper::Validations

def valid?

def valid?
  validate
  @error.nil?
end

def validate

def validate
  @error = nil
  self.class.validations.each do |validation|
    @error = validation[:options][:error] unless send("validate_#{validation[:attribute]}")
    break if @error
  end
end