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.
This commit is contained in:
Javi Martín
2021-06-23 02:50:22 +02:00
parent 82c8a5896a
commit b318a8b8d2

View File

@@ -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