Calling link_to from rake task

I have a rake task, which informs users about all kind of statuses in
the application by e-mail.

It would be nice if I could create active links together with statuses.
But have noticed that link_to helper is not available for rake or
ActionMailer. Is there an easy way to include link_to helper in rake or
example below is the only sane way of doing it :frowning:

body << '<a href="http://my.site.com/link">Link</a>'

by
TheR

Use a template. All the usual view helpers will be available there. You’ll also want to make sure you set default_url_options:

http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views

otherwise all your links will be missing the host part.

–Matt Jones