How to get url_for an object in Model method in Rails
include Rails.application.routes.url_helpers
def notification_content
"#{listing_url(my_listing, :host => "example.com")}. " + ...
end
(From the comments, credit to Edward Anderson)
Prepend url_for with:
Rails.application.routes.url_helpers.*url_for(...)*