我的application.html.erb文件中有一个基本布局,该布局用于显示应用程序中许多页面的布局。我需要在其中一个控制器中添加另一个页面,但需要使用其他布局,而不是application.html.erb。如何在每个动作和控制器的基础上重写此设置?
在controller.rb中使用布局
class FooController < ApplicationController
layout 'application2' # application2.html.erb
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句