Rails 3.1:视图未在命名空间布局中呈现



In routes.rb:

namespace :admin do
    root :controller => "base", :action => "index"
    resources :products
end

产品控制器继承自基本控制器:

class Admin::BaseController < ApplicationController
   #layout 'admin'
   def index
   end
end
class Admin::ProductsController < Admin::BaseController
   def index
   end
end

如果没有"layout'admin'",两个索引视图都会正常呈现。

使用"layout‘admin’",管理布局被呈现,但视图没有被呈现,尽管WEBricks消息:

Rendered admin/products/index.html.erb within layouts/admin

<%= yield %>可能会有所帮助,配合

最新更新