是否可以从文本数据字段中读取字符串并将其呈现为布局?
1.html.erb
如果我使用它,它会在布局下查找文件:
layout: '1'
是否可以从文本数据字段中读取字符串并将其呈现为布局?
1.html.erb
如果我使用它,它会在布局下查找文件:
layout: '1'
您可以在调用中传递布局的名称来渲染
def show
@team = Team.find_by name: 'Red Sox'
render action: :show, layout: @team.preferred_layout
end
Check out http://guides.rubyonrails.org/layouts_and_rendering.html
All of the official rails docs are a great resource
To render text use
render text: "OK"