Bill
2006-May-27 09:00 UTC
[Rails] Route 1st domain to a controller, 2nd domain to con/act/id
I''m having trouble with mapping a first domain to: map.connect '':action'', :controller => ''admin'' I can get that to work, and I''d be fine if there''s only one domain pointing to my app. However, I will point several domains to the app, so I only want that route for one domain. I''ve tried: map.connect '':action'', :controller => ''admin'' if @request.host == ''domain.com'' but I get an error about nil.host. I''m not sure but it seems @request is undefined in routes.rb. How might I get this done? Thanks, Bill -- Posted via http://www.ruby-forum.com/.
Roman LE NEGRATE
2006-May-27 09:46 UTC
[Rails] Route 1st domain to a controller, 2nd domain to con/act/id
> I''ve tried: > > map.connect '':action'', :controller => ''admin'' if @request.host => ''domain.com'' > > but I get an error about nil.host. I''m not sure but it seems @request > is undefined in routes.rb. > > > How might I get this done?Hello Bill, You should take a look at the Rails "Request Routing" plugin mentioned in the following post: http://weblog.rubyonrails.org/articles/2006/05/22/dan-webbs-request- routing-plugin It looks like it will fullfill your need. Roman
Bill
2006-May-27 13:15 UTC
[Rails] Re: Route 1st domain to a controller, 2nd domain to con/act/
> You should take a look at the Rails "Request Routing" plugin > mentioned in the following post: > http://weblog.rubyonrails.org/articles/2006/05/22/dan-webbs-request- > routing-plugin >That looks good. A little more digging reveals routes.rb is set once, before @request is set. The plugin is a nice work around. Thanks, Bill -- Posted via http://www.ruby-forum.com/.