On Dec 30, 2005, at 4:52 PM, Nathaniel S. H. Brown wrote:

I have tried all night trying to find a way to get the host name which is currently being used within my routes.rb file to do some case/when switching
for specific domains such as this

        cgi = ActionController::CgiRequest.new(CGI.new)
        case cgi.domain(1)
                when /www/
                        map.connect '', :controller => 'public', :action =>
'index'
                when /internal/
                        map.connect '', :controller => 'admin', :action =>
'index'
        end

And have had no success. The domain(1) is empty in this case.

I have tried a similar approach in one of my views, using the
@request.domain(1) and that works PERFECT. Yet I have found no way to access the same @request.domain(1) within my routes.rb as the @request object has
not been loaded yet.

One thought was to use the ENV['HTTP_HOST'] variable. But this appears to be
empty with my lighttpd/apache2 setup.

- Nathaniel


Nathaniel,

This sounds like a topic for discussion outside of the core list (unless you're looking for advice on how to implement this feature into the Rails code base or would like some kind of peer review for your idea or code).

I'll send a message to the rails list with my thoughts on this situation.

Duane Johnson
(canadaduane)
http://blog.inquirylabs.com/


_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to