Yes, but... (I had this issue some time ago)
What if I am using an ActiveRecord callbacks to generate my emails? I
ended-up refactoring and creating the email from the controller, passing
the url as a parameter as you mentionned. Too bad since callbacks felt
nice for this kind of thing.
Was there any other option?
Jarkko Laine wrote:
> On 19.10.2005, at 11.05, Jeroen Houben wrote:
>
>> Hi,
>>
>> I''m trying to use url_for in a View that renders an email.
>> The method is not a available in that View, probably because
it''s
>> not tied to a controller (??)
>>
>> Does anybody know a good way of making these url methods available
>> in the View, or perhaps anybody knows of good reasons why they
>> shouldn''t be available.
>
>
> This is Jamis Buck''s response to this question in August (http://
> thread.gmane.org/gmane.comp.lang.ruby.rails/17849):
>
> Currently, url_for is not accessible in mailer classes. The reason is
> that url_for requires some infrastructure that is not available in
> mailer classes. Until someone submits a patch that changes that, the
> only way to take advantage of url_for in mailer classes is to do
> something like:
>
> # in the controller
> url = url_for(...)
> SomeMailer.deliver_some_mail(url)
>
> And then use the passed value to help render the mail.
>
> - Jamis
>
>
> //jarkko
>
>
>
>>
>> TIA,
>>
>> Jeroen
>> _______________________________________________
>> Rails mailing list
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>>
>
> --
> Jarkko Laine
> http://jlaine.net
> http://odesign.fi
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Rails mailing list
>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>