简体   繁体   中英

Using a layout other than application.html.erb in ruby on rails application?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM