I would like to create a string that include a path for an object in Rails.
def notification_content
"#{app.listing_url(my_listing, :host => "example.com")}. " +
end
This content will then be fed into my ActionMailer as email content.
In console, it works fine. However, when I run it on localhost server, I get the following error:
undefined local variable or method `app'
How should I go about it? Also, how can I make the path to be a hyperlink?
Thanks a lot.
include Rails.application.routes.url_helpers
def notification_content
"#{listing_url(my_listing, :host => "example.com")}. " + ...
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With