Skip to content

Commit

Permalink
Merge pull request ManageIQ#16887 from bdunne/prefer_pluck
Browse files Browse the repository at this point in the history
Prefer pluck over collect on database objects to avoid extra ruby objects
  • Loading branch information
carbonin authored Jan 25, 2018
2 parents 2d453c0 + e757282 commit 9f87340
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/miq_server/role_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def check_server_roles
end

def server_role_names
server_roles.collect(&:name).sort
server_roles.pluck(:name).sort
end
alias_method :my_roles, :server_role_names
alias_method :assigned_role_names, :server_role_names
Expand Down Expand Up @@ -174,11 +174,11 @@ def assign_role(server_role, priority = nil)
end

def inactive_role_names
inactive_roles.collect(&:name).sort
inactive_roles.pluck(:name).sort
end

def active_role_names
active_roles.collect(&:name).sort
active_roles.pluck(:name).sort
end

def active_role
Expand Down

0 comments on commit 9f87340

Please sign in to comment.