Calling link_to from rake task

30 views
Skip to first unread message

Damjan Rems

unread,
Aug 8, 2014, 7:00:32 AM8/8/14
to rubyonra...@googlegroups.com
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 :-(

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


by
TheR

--
Posted via http://www.ruby-forum.com/.

Matt Jones

unread,
Aug 10, 2014, 10:36:04 AM8/10/14
to rubyonra...@googlegroups.com


On Friday, 8 August 2014 07:00:32 UTC-4, Ruby-Forum.com User wrote:
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 :-(

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


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


otherwise all your links will be missing the host part.

--Matt Jones 
Reply all
Reply to author
Forward
0 new messages