List Info

Thread: Subdomains, Routing, and Subdirectory Controllers




Subdomains, Routing, and Subdirectory Controllers
country flaguser name
United States
2007-03-31 17:47:31
For reference, this question is similar to "Subdomains,
Session Data,
& Routing" posted Oct. 31, 2006.  Link:

http://gro
ups.google.com/group/rubyonrails-talk/browse_thread/thread/d
3c5072c3588a1e0/f87d0fdfded31650
----

I would like to set up a subdomain and, using the
request_routing
plugin, have requests to that subdomain call corresponding
"sub-
controllers" inside a controller module.  That way,
urls like:

http://sub.exa
mple.com/target/myaction

could be routed to call:

Grouped::TargetController#myaction  (located in
/app/controllers/
grouped/target_controller.rb)


I realize one solution would be to use "Option #2"
in the referenced
post above and create an action dedicated to parsing the url
and
redirecting to the appropriate controller/action.  However,
I was
wondering if a simpler approach could be taken through the
routing
code by doing something along these lines:

# match sub.example.com
map.with_options :conditions => { :subdomain => 'sub'
} do |sub|
  sub.connect ':target/:action/:id', :controller =>
"sub/:target"
end

Any help would be greatly appreciated!


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


(Correction)
country flaguser name
United States
2007-03-31 18:08:07
Note: The route in the example code should read:

sub.connect ':target/:action/:id', :controller =>
"grouped/:target"


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )