diff --git a/app/components/shared/recommended_index_component.html.erb b/app/components/shared/recommended_index_component.html.erb index 4a2992549..7432bf193 100644 --- a/app/components/shared/recommended_index_component.html.erb +++ b/app/components/shared/recommended_index_component.html.erb @@ -19,7 +19,7 @@ <% recommended.each do |recommended| %>
-

<%= link_to recommended.title, recommended_path(recommended) %>

+

<%= link_to recommended.title, polymorphic_path(recommended) %>

<% end %> diff --git a/app/components/shared/recommended_index_component.rb b/app/components/shared/recommended_index_component.rb index 91493c6e6..cbace8337 100644 --- a/app/components/shared/recommended_index_component.rb +++ b/app/components/shared/recommended_index_component.rb @@ -1,6 +1,6 @@ class Shared::RecommendedIndexComponent < ApplicationComponent attr_reader :recommended, :disable_recommendations_path, :namespace - use_helpers :recommended_path, :current_path_with_query_params + use_helpers :current_path_with_query_params def initialize(recommended, disable_recommendations_path:, namespace:) @recommended = recommended diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 85ee522da..cda8b110e 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -7,17 +7,6 @@ module WelcomeHelper "display: none;" if index.positive? end - def recommended_path(recommended) - case recommended.class.name - when "Debate" - debate_path(recommended) - when "Proposal" - proposal_path(recommended) - else - "#" - end - end - def render_recommendation_image(recommended) image_path = calculate_image_path(recommended) image_tag(image_path) if image_path.present? diff --git a/app/views/welcome/_recommended_carousel.html.erb b/app/views/welcome/_recommended_carousel.html.erb index da2ac25f5..def55377d 100644 --- a/app/views/welcome/_recommended_carousel.html.erb +++ b/app/views/welcome/_recommended_carousel.html.erb @@ -13,7 +13,7 @@
<%= render_recommendation_image(recommended) %>
- <%= link_to recommended_path(recommended) do %> + <%= link_to polymorphic_path(recommended) do %>

<%= recommended.title %>

<% end %> <%= wysiwyg(recommended.description) %>