Skip to content

Commit

Permalink
Always include user/entity for AuthorizationRequest#events
Browse files Browse the repository at this point in the history
  • Loading branch information
skelz0r committed Apr 1, 2024
1 parent 1c661d7 commit d48f4e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Instruction::AuthorizationRequestEventsController < Instruction::Authoriza
def index
authorize [:instruction, @authorization_request], :show?

@events = @authorization_request.events.includes(%i[user entity]).order(created_at: :desc).decorate
@events = @authorization_request.events.order(created_at: :desc).decorate
end

private
Expand Down
1 change: 1 addition & 0 deletions app/queries/authorization_request_events_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def initialize(authorization_request)
# rubocop:disable Metrics/AbcSize
def perform
AuthorizationRequestEvent
.includes(%i[user entity])
.where(
sql_query,
authorization_request.id,
Expand Down
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs

Bullet.add_safelist type: :unused_eager_loading, class_name: 'AuthorizationRequestEvent', association: :entity
Bullet.add_safelist type: :unused_eager_loading, class_name: 'AuthorizationRequestEvent', association: :user
end

# Settings specified here will take precedence over those in config/application.rb.
Expand Down

0 comments on commit d48f4e4

Please sign in to comment.