From 1f4e3305b9f2322e0a8e3511b6064d65269e1e7a Mon Sep 17 00:00:00 2001 From: Lee Lawlor Date: Tue, 6 May 2014 14:05:54 -0400 Subject: [PATCH] make sure api key finders are strings --- app/controllers/api_keys_controller.rb | 4 ++-- app/controllers/application_controller.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb index 9653962..905a37c 100644 --- a/app/controllers/api_keys_controller.rb +++ b/app/controllers/api_keys_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 96ada82..bdec2d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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