make sure api key finders are strings

This commit is contained in:
Lee Lawlor 2014-05-06 14:05:54 -04:00
parent 6344d7ce3e
commit 1f4e3305b9
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ class ApiKeysController < ApplicationController
end
def destroy
current_user.api_keys.find_by_api_key(params[:id]).try(:destroy)
current_user.api_keys.find_by_api_key(params[:id].to_s).try(:destroy)
redirect_to :back
end
@ -34,7 +34,7 @@ class ApiKeysController < ApplicationController
end
def update
@api_key = current_user.api_keys.find_by_api_key(params[:id])
@api_key = current_user.api_keys.find_by_api_key(params[:id].to_s)
@api_key.update_attributes(api_key_params)
redirect_to :back
end

View File

@ -201,7 +201,7 @@ class ApplicationController < ActionController::Base
def get_apikey
key = get_header_value(HTTP_HEADER_API_KEY_NAME) || params[:key] || params[:api_key] || params[:apikey]
key.strip if key.present?
return key
return key.to_s
end
# get specified header value