Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
Remove a couple N+1 queries (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
hopsoft authored and andrewmcodes committed Oct 9, 2019
1 parent 3a81c44 commit 9e02cfc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def user_statuses_for_select
end

def advertisers_for_select
User.advertisers.sort_by(&:scoped_name).map { |user| [user.scoped_name, user.id] }
User.advertisers.includes(:organization).sort_by(&:scoped_name).map { |user| [user.scoped_name, user.id] }
end

def organizations_for_select
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/campaigns/presentable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Presentable
include ActionView::Helpers::TextHelper

def scoped_name(truncate: false)
value = [user.scoped_name, name, creative&.name].compact.join "・"
value = [organization&.name, user.name, name, creative&.name].compact.join "・"
value = truncate(value, length: 60) if truncate
value
end
Expand Down

0 comments on commit 9e02cfc

Please sign in to comment.