"index" resources :pr-6ren">
gpt4 book ai didi

ruby-on-rails - rails 3.1 : Views not rendering in namespace layout

转载 作者:行者123 更新时间:2023-12-04 16:52:59 25 4
gpt4 key购买 nike

在routes.rb:

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

products Controller 继承自基本 Controller :
class Admin::BaseController < ApplicationController
#layout 'admin'
def index
end
end

class Admin::ProductsController < Admin::BaseController
def index
end
end

如果没有“layout 'admin'”,两个索引 View 都会正常呈现。

使用“layout 'admin'”,会呈现管理布局,但不会呈现 View ,尽管 WEBricks 消息:
Rendered admin/products/index.html.erb within layouts/admin

最佳答案

<%= yield %>可能会有所帮助,伙计

关于ruby-on-rails - rails 3.1 : Views not rendering in namespace layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6202056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com