3

I've got a 'static' controller and static views that are pages that don't utilize ruby in their views. For these pages, I have a sitemap partial that is generated programatically and used in the application layout file. Namespaced routes still use the application layout file but are taking the static routes and trying to namespace them too.

Here's the relevant portion of the route file:

namespace :admin do
  resources :verse_categories
  resources :verses
  resources :songs
  resources :flowers
  resources :visits, :except => [:new, :create]
end
match ':action' => 'static'
root :to => 'static#home'

Here's the error I'm getting:

No route matches {:controller=>"admin/static", :action=>"about"}

Note that about is one of the static pages that the sitemap partial uses.

So, how can I resolve this routing issue so that it's not trying to find my static sites inside of the admin namespace? Any help would be appreciated!

iand675
  • 1,118
  • 1
  • 11
  • 23
  • Where does that "No route matches" error come from? Is it because the links are wrong in the sitemap partial? – Heikki Dec 31 '10 at 07:24
  • This is pretty confusing :) Question title is all about partials and views while the question content seems to be about routes. – Heikki Dec 31 '10 at 11:34

2 Answers2

0

What about:

namespace :admin do
  ... 
  get "/about" => "static#about"
end

Or

scope "/admin" do
  get "/about" => "static#about"
end
apneadiving
  • 114,565
  • 26
  • 219
  • 213
0

This gist explains how to add directories to the search path for namespaced directories. I ended up doing the following:

class Static::BaseController < ApplicationController
  def self._prefixes
    super | ["other_directory"]
  end
end
Kurt Mueller
  • 3,173
  • 2
  • 29
  • 50