Commit 36eefde0405cef572046d293b05efeec82db2591

Authored by Antonio Terceiro
1 parent e09c2fa4

ActionItem1178: moving custom domain routing last

Due to changes in the route recognization in Rails 2.1, the pure globbing
routes are always tested last, so the check for a hosted domain must be
done in the regular profile route.
Showing 1 changed file with 4 additions and 4 deletions   Show diff stats
config/routes.rb
... ... @@ -84,10 +84,10 @@ ActionController::Routing::Routes.draw do |map|
84 84 # cache stuff - hack
85 85 map.cache 'public/:action/:id', :controller => 'public'
86 86  
87   - # match requests for content in domains hosted for profiles
88   - map.connect '*page', :controller => 'content_viewer', :action => 'view_page', :conditions => { :if => lambda { |env| Domain.hosting_profile_at(env[:host])} }
  87 + # match requests for profiles that don't have a custom domain
  88 + map.homepage ':profile/*page', :controller => 'content_viewer', :action => 'view_page', :profile => /#{Noosfero.identifier_format}/, :conditions => { :if => lambda { |env| !Domain.hosting_profile_at(env[:host]) } }
89 89  
90   - # XXX this route must come last so other routes have priority over it.
91   - map.homepage ':profile/*page', :controller => 'content_viewer', :action => 'view_page', :profile => /#{Noosfero.identifier_format}/
  90 + # match requests for content in domains hosted for profiles
  91 + map.connect '*page', :controller => 'content_viewer', :action => 'view_page'
92 92  
93 93 end
... ...