Skip to content

Commit

Permalink
Move before action for regenerate_api_key
Browse files Browse the repository at this point in the history
Raising for missing callback actions is a new default in Rails 7.1. Therefore
a callback that is defined by an extended concern will cause a failure if the
action is not defined. The `regenerate_api_key` only exists for external user
admin so the callback needs to be moved from the concern to the controller.
  • Loading branch information
jrmhaig committed Sep 6, 2024
1 parent f0006ea commit 8dd8d99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/concerns/provider_admin_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ProviderAdminConcern
extend ActiveSupport::Concern

included do
before_action :set_provider, only: %i[show edit update regenerate_api_key]
before_action :set_provider, only: %i[show edit update]
end

private
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/external_users/admin/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Admin
class ProvidersController < ExternalUsers::Admin::ApplicationController
include ProviderAdminConcern

before_action :set_provider, only: :regenerate_api_key

def regenerate_api_key
@provider.regenerate_api_key!
redirect_to external_users_admin_provider_path(@provider), notice: t('.notice')
Expand Down

0 comments on commit 8dd8d99

Please sign in to comment.