I have a website that has 3 main sections:
- Tickets
- Company (About Us)
- Admin
I would prefer to use subdomains for these sections:
tickets.whatever.com, company.whatever.com
The problem though is that I need a specific set of controllers for each
section. I dont want to do tickets.whatever.com/tickets/some_controller.
It kind of defeats the purpose of a subdomain.
Any ideas?
Thanks for your help.
On Jun 7, 2:52 am, Ben J. [email protected]
wrote:
I have a website that has 3 main sections:
- Tickets
- Company (About Us)
- Admin
I would prefer to use subdomains for these sections:
tickets.whatever.com, company.whatever.com
This should be done with routes. You have to rewrite routes and
url_for a bit. And don’t forget to set
ActionController::Base.session_options[:session_domain] to
“.whatever.com”
I don’t think in your case you’ll benefit much from using subdomains,
but it’s only up to to decide whether to spend decent amount of time
hacking ActionController::Routing to and
ActionView::Helpers::UrlHelper to map things back and forth, or rest
happy with default routing.
The problem though is that I need a specific set of controllers for each
section. I dont want to do tickets.whatever.com/tickets/some_controller.
Does it means ‘tickets’ is module in your setup, like in
Tickets::SomeTicketsController#action_on_ticket?
You don’t need it anyway, TicketsController filled with tickets
related actions is enough.
On 07 Jun 2007, at 01:52, Ben J. wrote:
each
section. I dont want to do tickets.whatever.com/tickets/
some_controller.
It kind of defeats the purpose of a subdomain.
You should use the request_routing plugin from Dan W…
http://agilewebdevelopment.com/plugins/request_routing
Best regards
Peter De Berdt
Actually, using the request_routing plugin is a good idea, as it
allows you to map to different controllers based on subdomain. I use
it for exactly that purpose myself.
–
Benjamin C.
http://www.bencurtis.com/ – blog
http://agilewebdevelopment.com/rails-ecommerce – build e-commerce
sites with Rails