Forum: Ruby on Rails url_for in ActionMailer?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-12-04 05:32
(Received via mailing list)
I'd like to insert a url in an email template. I tried this, but it
gives an 'undefined method'
error (probably because ActionMailer doesn't derive from
ActionController or apparently have
access to the ActionView helpers):

<%= url_for :controller=>'member', :action=>'show',
:username=>@member.username %>

Is there a quick and easy workaround?

thanks
csn



__________________________________________
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
2ee1028723473faa763884e902ce3366?d=identicon&s=25 thiessen (Guest)
on 2005-12-04 15:00
(Received via mailing list)
CSN <cool_screen_name90001@...> writes:

>
> I'd like to insert a url in an email template. I tried this, but it gives an
'undefined method'
>
> Is there a quick and easy workaround?

Quick and easy?  Yes.  Satisfying?  Definitely not.

Just generate the URL in your controller and pass it to the template as
a
parameter.  Works fine, but it just isn't right: it's so obvious that
you will
want to email computed URLs to people that you should be able to do it
directly.

Rails ticket #1138 (http://dev.rubyonrails.org/ticket/1138) is about
this.

--Forrest
This topic is locked and can not be replied to.