How could I create and use a new template instead of application.html.erb in a RoR application? What are the setting that I need to change to have another template?
Actually, all controllers will search for same-named layouts by default inside /views/layouts
folder with fallback to application.html.erb
. For example, UsersController
will search for users.html.erb
. Anyway, to use other layout add next to your controller:
class UsersController < ApplicationController
layout 'custom'
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.