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!

4

2 回答 2

0

关于什么:

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

或者

scope "/admin" do
  get "/about" => "static#about"
end
于 2010-12-31T11:28:26.063 回答
0

这个要点解释了如何将目录添加到命名空间目录的搜索路径。我最终做了以下事情:

class Static::BaseController < ApplicationController
  def self._prefixes
    super | ["other_directory"]
  end
end
于 2019-05-30T20:12:48.200 回答