Skip to content

Commit

Permalink
Fix stats page
Browse files Browse the repository at this point in the history
Uses link_to_if which internally calls link_to
The signature for the custom link_to doesn't match what rails defines
  • Loading branch information
Earlopain committed Oct 25, 2023
1 parent 788f582 commit 76816f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def time_ago(value)
end

# Properly support the method keyword argument
def link_to(text, url, **args)
if args[:method]
button_to(text, url, **args)
def link_to(name = nil, options = nil, html_options = nil, &)
if html_options&.dig(:method)
button_to(name, options, html_options, &)
else
super(text, url, **args)
super
end
end

Expand Down
10 changes: 10 additions & 0 deletions test/controllers/stats_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require "test_helper"

class StatsControllerTest < ActionDispatch::IntegrationTest
test "index renders" do
get stats_path
assert_response :success
end
end

0 comments on commit 76816f8

Please sign in to comment.