Skip to content

Commit

Permalink
Allow hobo_front_controller to create subsite front controllers. [#44…
Browse files Browse the repository at this point in the history
…4 state:resolved]
  • Loading branch information
bryanlarsen committed Oct 22, 2009
1 parent 3faa823 commit 9546b74
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -46,8 +46,16 @@ def add_routes
routes_path = File.join(RAILS_ROOT, "config/routes.rb")
name = full_class_path

route = (" map.site_search 'search', :controller => '#{name}', :action => 'search'\n" +
" map.root :controller => '#{name}', :action => 'index'")
root = class_nesting_depth>0 ? class_nesting.underscore : "root"

route = " map.site_search 'search', :controller => '#{name}', :action => 'search'\n"
if class_nesting_depth == 0
route+= " map.root :controller => '#{name}', :action => 'index'"
elsif class_nesting_depth == 1
route+= " map.#{class_nesting.underscore} '/#{class_nesting.underscore}', :controller => '#{name}', :action => 'index'"
else
assert false, "no support for class_nesting_depth>1"
end

route_src = File.read(routes_path)
return if route_src.include?(route)
Expand Down

0 comments on commit 9546b74

Please sign in to comment.