Url_for in ActionMailer?

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

CSN <[email protected]…> 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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs