hi everyone,
I''m trying to set up a routing command so that the
''www'' subdomain would
always be directed to my ''site'' controller, while all other
subdomain
urls (like username.localhost.com)be sent to the ''user''
controller.
I have installed the request routing plugin
(http://wiki.rubyonrails.org/rails/pages/Request+Routing)
and this is what i have in routes.rb:
map.connect '''', :controller => ''site'',
:requirements => { :subdomain =>
''www''}
map.connect '''', :controller => ''user'',
:action => ''index''
It seems that no matter what subdomain I call (www.localhost.com /
myuser.localhost.com) it always gets routed to the site controller.
Also, how is it possible to route the following url to an account
controller:
www.localhost.com/account/logout?
there is no id in this url - will the following route work:
map.connect '':controller/:action/''?
How can I only route it if the controller is ''account''?
Thanks!
Ehud
--
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?hl=en
-~----------~----~----~----~------~----~------~--~---
On Mar 17, 2007, at 11:13 PM, Ehud Rosenberg wrote:> I have installed the request routing plugin > (http://wiki.rubyonrails.org/rails/pages/Request+Routing) > > and this is what i have in routes.rb: > map.connect '''', :controller => ''site'', :requirements => > { :subdomain => > ''www''}It is right, only :requirements should be :conditions.> Also, how is it possible to route the following url to an account > controller: > www.localhost.com/account/logout? > there is no id in this url - will the following route work: > map.connect '':controller/:action/''? > How can I only route it if the controller is ''account''?It just works with default routes, note that you don''t need it in the canonical CRUD''s index/list actions. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
hmmm, it seems that even when I change it to :conditions it still routes
to the site/index:
map.connect '''', :controller => ''site'',
:action=>''index'', :conditions =>
{ :subdomain => ''www''}
and the url i access is: test.localhost.com:3001.
I get routed to the main site instead of to the account controller.
Any idea why?
Thanks!
--
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?hl=en
-~----------~----~----~----~------~----~------~--~---
On Mar 17, 2007, at 11:55 PM, Ehud Rosenberg wrote:> > hmmm, it seems that even when I change it to :conditions it still > routes > to the site/index: > > map.connect '''', :controller => > ''site'', :action=>''index'', :conditions => > { :subdomain => ''www''} > > and the url i access is: test.localhost.com:3001. > I get routed to the main site instead of to the account controller. > > Any idea why?It''s strange, these routes are working for me: map.connect '''', :controller => "public", :action => ''index'', :conditions => {:subdomain => ''www''} map.connect '''', :controller => "invoices", :action => ''new'' They seem analogous to yours. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Is there anything I should do excpet plguin/install the request_routing plug in? Do i have to use it somewhere in my application? -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 18, 2007, at 12:08 AM, Ehud Rosenberg wrote:> > Is there anything I should do excpet plguin/install the > request_routing > plug in?The server needs a restart to load the plugin (that happens with any plugin), nothing else. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---