routes: replace hardcoded routes in models with route helpers.
Add a Routes module that gives models access to route helpers outside of views, and use it to replace various hardcoded routes.
This commit is contained in:
@@ -21,7 +21,7 @@ class Comment < ApplicationRecord
|
||||
mentionable(
|
||||
:message_field => :body,
|
||||
:title => ->(user_name) {"#{creator.name} mentioned you in a comment on post ##{post_id}"},
|
||||
:body => ->(user_name) {"@#{creator.name} mentioned you in a \"comment\":/posts/#{post_id}#comment-#{id} on post ##{post_id}:\n\n[quote]\n#{DText.extract_mention(body, "@" + user_name)}\n[/quote]\n"}
|
||||
:body => ->(user_name) {"@#{creator.name} mentioned you in a \"comment\":#{Routes.post_path(post, anchor: "comment-#{id}")} on post ##{post_id}:\n\n[quote]\n#{DText.extract_mention(body, "@" + user_name)}\n[/quote]\n"}
|
||||
)
|
||||
|
||||
module SearchMethods
|
||||
|
||||
Reference in New Issue
Block a user