refactor: update rankings action to pass current_player
Refactor rankings action to use render_with_player helper for consistent current_player availability across views. Changes: - Update rankings action to use render_with_player - Ensure current_player is available in all view templates
This commit is contained in:
@@ -6,10 +6,10 @@ module EuchreCamp
|
|||||||
class Rankings < EuchreCamp::Action
|
class Rankings < EuchreCamp::Action
|
||||||
include Deps[repo: 'repositories.players']
|
include Deps[repo: 'repositories.players']
|
||||||
|
|
||||||
def handle(_request, response)
|
def handle(request, response)
|
||||||
# Get all players and sort by current Elo
|
# Get all players and sort by current Elo
|
||||||
players = repo.all.sort_by { |p| -p.current_elo }
|
players = repo.all.sort_by { |p| -p.current_elo }
|
||||||
response.render(view, players: players)
|
render_with_player(request, response, players: players)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user