From b318a8b8d2c797ddd36cc18438bdf669dad8d8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Jun 2021 02:50:22 +0200 Subject: [PATCH] Use polymorphic_path instead of Relationable#url The #url method in the models provides a feature that can be done using native Rails features (polymorphic paths), is inconsistent (some models have that method and some haven't), and only works for URLs in the public area (but not in sections like administration or management). Besides, models are already fat enough without introducing methods related to controllers or routes. --- app/controllers/related_contents_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/related_contents_controller.rb b/app/controllers/related_contents_controller.rb index 1e85c8c53..bbb391465 100644 --- a/app/controllers/related_contents_controller.rb +++ b/app/controllers/related_contents_controller.rb @@ -15,7 +15,7 @@ class RelatedContentsController < ApplicationController else flash[:error] = t("related_content.error", url: Setting["url"]) end - redirect_to @relationable.url + redirect_to polymorphic_path(@relationable) end def score_positive