link_to :controller => 'mycontroller', :action => 'myaction', :host => (request.protocol + request.host)
If that doesn't work, your issue is probably that those methods aren't available to ActionMailer::Base. I didn't check myself so I'm not sure.
On Jun 26, 2007, at 2:42 PM, Glenn Little wrote:
I'm trying to build a url from inside a controller/action. I want
this url to contain the hostname ("http://myhost.edu/...")
I'd like the hostname to by dynamic, but if I use:
url_for :controller => "mycontroller", :action => "myaction"
I get the error:
Missing host to link to! Please provide :host parameter or set
default_url_options[:host]
I've also tried to get at, e.g., request.env[], but that too is unknown in the controller (not sure why). Is there a "right" way to build a url that includes the current hostname, whatever it is? I was also hoping not to have to wire something into environment.rb, but maybe that's "correct". At this point, I'm just trying to generalize user_notifier.rbin RestfulAuthentication so that I don't have to hardwire the hostname in the activation url that's sent out. This controller
inherits from ActionMailer::Base (hmmm... is that the problem?).
Thanks.
-glenn
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Sdruby mailing list [email protected] http://lists.sdruby.com/mailman/listinfo/sdruby
