mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
This commit is contained in:
@@ -5,7 +5,7 @@ class Admin::ApiController < Admin::AdminController
|
||||
end
|
||||
|
||||
def regenerate_key
|
||||
api_key = ApiKey.where(id: params[:id]).first
|
||||
api_key = ApiKey.find_by(id: params[:id])
|
||||
raise Discourse::NotFound.new if api_key.blank?
|
||||
|
||||
api_key.regenerate!(current_user)
|
||||
@@ -13,7 +13,7 @@ class Admin::ApiController < Admin::AdminController
|
||||
end
|
||||
|
||||
def revoke_key
|
||||
api_key = ApiKey.where(id: params[:id]).first
|
||||
api_key = ApiKey.find_by(id: params[:id])
|
||||
raise Discourse::NotFound.new if api_key.blank?
|
||||
|
||||
api_key.destroy
|
||||
|
||||
Reference in New Issue
Block a user