I saw on the bottom of the following page that you can route requests to different controllers based upon which subdomain is being requested. http://wiki.rubyonrails.com/rails/pages/Routes with_options :requirements=>{:subdomain=>''first.com''} do map.connect '''', :controller => "first/catalog" map.connect ''featured'', :controller => "first/catalog", :action=>''featured'' map.connect ''catalog/:action/:id'', :controller => "first/catalog" end So you could have one home page setup for one subdomain and another home page for another subdomain. I''ve tried implementing this with Edge Rails, but haven''t had any luck. The :subdomain requirement doesn''t seem to have any affect. I must be missing something. I''ve looked through the Edge Rails documentation and haven''t seen anything that talks about using :subdomain. Does the domain or subdomain need to be passed into the routes somehow? Any help would be appreciated. -- Posted via http://www.ruby-forum.com/.
I just noticed what looks like an error in the code on the Wiki. I think it should be: map.with_options :requirements=>{:subdomain=>''first.com''} do |m| m.connect '''', :controller => "first/catalog" m.connect ''featured'', :controller => "first/catalog", :action=>''featured'' m.connect ''catalog/:action/:id'', :controller => "first/catalog" end Although this still doesn''t seem to help with the :subdomain requirement. -- Posted via http://www.ruby-forum.com/.
I''m running Rails 1.1 RC1 and Webbrick reports a Content-Length: 0 for any dynamic content it delivers. When I serve static content (like images) the Content-Length is calculated correctly. I''m trying to track down an obscure bug and this is one difference bewteen a system that is working and one that isn''t. curl -I http://localhost:3000/page/otml/1 HTTP/1.1 200 OK Cache-Control: no-cache Connection: Keep-Alive Date: Fri, 24 Mar 2006 05:45:16 GMT Content-Type: text/xml; charset=UTF-8 Server: WEBrick/1.3.1 (Ruby/1.8.4/2005-12-24) Content-Length: 0 Set-Cookie: _session_id=109456392dcb2d36dbd500ee5d3ddb1f; path=/ The actual Content-Length is 8620. -- - Stephen Bannasch Concord Consortium, http://www.concord.org
Ross Karchner
2006-Mar-27 03:57 UTC
[Rails] Re: Domain Requirements in Routes (Edge Rails)
Has anyone seen :requirements=>{:subdomain=>whatever} in the wild? Is it documented anywhere other than that wiki page? On 2006-03-23 16:48:31 -0500, Ben Blakley <ben@reussnewmedia.com> said:> I just noticed what looks like an error in the code on the Wiki. I > think it should be: > > map.with_options :requirements=>{:subdomain=>''first.com''} do |m| > m.connect '''', :controller => "first/catalog" > m.connect ''featured'', :controller => "first/catalog", :action=>''featured'' > m.connect ''catalog/:action/:id'', :controller => "first/catalog" > end > > Although this still doesn''t seem to help with the :subdomain requirement.
I too have been unable to get :subdomain to work on the latest Rails trunk. Rails appears to be blissfully unaware of it. Anyone had any success with this? Orya Ross Karchner <rosskarchner@...> writes: > > Has anyone seen :requirements=>{:subdomain=>whatever} in the wild? Is > it documented anywhere other than that wiki page? > > On 2006-03-23 16:48:31 -0500, Ben Blakley > <ben@...> said: > > > I just noticed what looks like an error in the code on the Wiki. I > > think it should be: > > > > map.with_options :requirements=>{:subdomain=>''first.com''} do |m| > > m.connect '''', :controller => "first/catalog" > > m.connect ''featured'', :controller => "first/ catalog", :action=>''featured'' > > m.connect ''catalog/:action/:id'', :controller => "first/catalog" > > end > > > > Although this still doesn''t seem to help with the :subdomain requirement.
yeah i''ve post the problem on the railsforum.com previously but noone answered that yet. i''m frustrated -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Frustration no more. See the Request Routing plugin. With the new routing code, it''s almost too easy! http://agilewebdevelopment.com/plugins/request_routing Ben Blakley wrote:> I saw on the bottom of the following page that you can route requests to > different controllers based upon which subdomain is being requested. > > http://wiki.rubyonrails.com/rails/pages/Routes > > with_options :requirements=>{:subdomain=>''first.com''} do > map.connect '''', :controller => "first/catalog" > map.connect ''featured'', :controller => "first/catalog", > :action=>''featured'' > map.connect ''catalog/:action/:id'', :controller => "first/catalog" > end > > So you could have one home page setup for one subdomain and another home > page for another subdomain. I''ve tried implementing this with Edge > Rails, but haven''t had any luck. The :subdomain requirement doesn''t seem > to have any affect. I must be missing something. I''ve looked through the > Edge Rails documentation and haven''t seen anything that talks about > using :subdomain. Does the domain or subdomain need to be passed into > the routes somehow? Any help would be appreciated.-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
i''ve installed the Request Routing plugin from that URL, but it does not seem to work on my application. the :requirements still does not have any effect. i can get the subdomain name with the SubdomainAsAccountKey plugin, but the subdomain routing can''t work. :( i need subdomain routing to map this: URL> admin.domain.com/setting # :controller=>''admin'', :action=>''setting'' URL> username.domain.com/setting # :controller=>''user'', :action=>''setting'' thanks in advance Doug Dupory wrote:> Frustration no more. See the Request Routing plugin. With the new > routing code, it''s almost too easy! > http://agilewebdevelopment.com/plugins/request_routing-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> i''ve installed the Request Routing plugin from that URL, but it does not > seem to work on my application. the :requirements still does not have > any effect. i can get the subdomain name with the SubdomainAsAccountKey > plugin, but the subdomain routing can''t work. :( >In the new version of Rails you need to use :conditions rather than :requirements Also, request routing just specifies a requirement for routing. EG. you can say things like only use these routes if the subdomain is not admin or whatever so it might not actually be the answer to your problem but in this case it looks like it will work. Cheers, -- Dan Webb http://www.danwebb.net --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Dan Webb wrote:>> i''ve installed the Request Routing plugin from that URL, but it does not >> seem to work on my application. the :requirements still does not have >> any effect. i can get the subdomain name with the SubdomainAsAccountKey >> plugin, but the subdomain routing can''t work. :( >> > > In the new version of Rails you need to use :conditions rather than > :requirements > > Also, request routing just specifies a requirement for routing. EG. > you can say things like only use these routes if the subdomain is not > admin or whatever so it might not actually be the answer to your > problem but in this case it looks like it will work. > > Cheers, > > -- > Dan Webb > http://www.danwebb.netI just dealt with this use this morning. I found the info in the README with the plugin. I forget if there are other changes. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
wow it works apperently i haven''t read the Readme file for the recent changes. i read the old manual from somewhere on the web. thanks Dan, you rocks :) it works when i tried this: map.connect ''setting'', :controller => ''admin'', :action => ''setting'', :conditions => { :subdomain => ''admin'' } map.connect ''setting'', :controller => ''user'', :action => ''setting'', :conditions => { :subdomain => ''user'' } but it fail when previously i tried this: map.with_options :conditions=>{:subdomain=>''admin''} do |map| map.connect ''setting'', :controller => ''admin'', :action => ''setting'' end map.with_options :conditions=>{:subdomain=>''user''} do |map| map.connect ''setting'', :controller => ''user'', :action => ''setting'' end map.with_options :conditions=>{:subdomain=>''test''} do |map| map.connect ''setting'', :controller => ''test'', :action => ''setting'' end the user subdomain generates ''Recognition failed for "/setting"''. i tried to add the test subdomain, and it generates the same error message. did i missed something? it''s ok though, i still can the without with_options version :) and somehow, i cannot connect to controller when i put an empty string to the map connect, it still connect to the main index. any suggestion? map.connect '''', :controller => ''admin'', :action => ''index'', :conditions => { :subdomain => ''admin'' } map.connect '''', :controller => ''user'', :action => ''index'', :conditions => { :subdomain => ''user'' } thanks, Adrian Liem Dan Webb wrote:> In the new version of Rails you need to use :conditions rather than > :requirements > > Also, request routing just specifies a requirement for routing. EG. > you can say things like only use these routes if the subdomain is not > admin or whatever so it might not actually be the answer to your > problem but in this case it looks like it will work. > > Cheers, > > -- > Dan Webb > http://www.danwebb.net-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---