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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user