Use the :host option to make it build the whole URL, like this:

url_for( {:host =>'customerdomain.com', :controller => 'page', :id => 1 } )

On Sun, Jan 18, 2009 at 2:57 PM, Conrad Chu <
[email protected]> wrote:

>
> Hi,
>
> I was wondering how to get url_for to work inside ActionMailer.  I did
> research on the web but I can't seem to find something that fits what I
> need.
>
> In my application, each user can specify their custom domain to access
> their.  I have an ActionMailer that sends them notifications of changes
> that occur.  In there, I have a breadcrumbs helper method, which
> generages something like:
>
> <a href="/page/1">1</a> &gt;  <a href="/page/2">2</a>
>
> I need it to be:
>
> <a href="http://customdomain/page/1";>1</a> &gt;  <a
> href="http://customdomain/page/2";>2</a>
>
> How do you that?  I tried using default_url_options but it doesn't
> affect the helper methods I'm using in the email.  Can somebody help me?
>
> Thanks!
> Conrad
>
> ----
>
> Here's an excerpt of my code:
>
> class UserNotifier < ActionMailer::Base
>  helper :application
>
>    # Emails the user the recent changes on the wiki
>  def changes(user, page)
>    ...
>    default_url_options[:host] = user.custom_host
>    @body => {"page" => page}
>    ...
>  end
> end
>
> views/user_notifer/changes.rhtml:
> <%= breadcrumbs(@page) %>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to