Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 RoR 应用程序中创建和使用新模板而不是 application.html.erb?我需要更改哪些设置才能拥有另一个模板?
实际上,默认情况下,所有控制器都会在/views/layouts回退到application.html.erb. 例如,UsersController将搜索users.html.erb. 无论如何,要使用其他布局,请在控制器旁边添加:
/views/layouts
application.html.erb
UsersController
users.html.erb
class UsersController < ApplicationController layout 'custom' end