API version returns last version set

* fixed in grape v0.2.2
4-1-stable
Nihad Abbasov 2012-11-29 13:42:22 -08:00
parent c177593e2c
commit 968c09ae91
2 changed files with 2 additions and 3 deletions

View File

@ -2,8 +2,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module Gitlab
class API < Grape::API
VERSION = 'v2'
version VERSION, using: :path
version 'v2', using: :path
rescue_from ActiveRecord::RecordNotFound do
rack_response({'message' => '404 Not found'}.to_json, 404)

View File

@ -18,7 +18,7 @@ module ApiHelpers
#
# Returns the relative path to the requested API resource
def api(path, user = nil)
"/api/#{Gitlab::API::VERSION}#{path}" +
"/api/#{Gitlab::API.version}#{path}" +
# Normalize query string
(path.index('?') ? '' : '?') +