概要
Controllerからlayoutの指定を行う
内容
Controllerからlayoutの指定を利用します。
render layout: "layout_name"
サンプルコード
bookshelf_controller.rb
class BookshelfController < ApplicationController def index render layout: "html5_layout" end def click_link redirect_to :controller => 'help', :action => 'index' end def message render :text => "message test" end end
!!! %html{:lang => "en"} %head %meta{:charset => "UTF-8"}/ %title layout_test %body layout_test = yield