When using subdomains as account keys (as per this HowTo:
http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys),
how can you get link_to to spit out the correct URL (i.e.
account123.domain.com)?
<%= link_to “My Account”, { :action => “show”, :id => “account123” }
%> would generate “http://www.domain.com/show/account123”
I don’t have any special routes setup (in routes.rb), but I don’t
think that would help for this purpose.
Thanks,
Sean
On Jan 18, 2006, at 7:45 AM, Sean M. wrote:
think that would help for this purpose.
in ApplicationControllor:
def url_for(options = {}, *params) # :nodoc:
if options[:subdomain] then
options[:only_path] = false
host = []
host << options.delete(:subdomain)
host << @request.subdomains[1…-1] if @request.subdomains.size
1
host << @request.domain
options[:host] = host.join ‘.’
end
return super(options, *params)
end
–
Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant
http://trackmap.robotcoop.com