如何更改默认布局目录? [英] How can I change the default layout directory?

查看:59
本文介绍了如何更改默认布局目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序具有位于 Utilisation 模块下的站点公共部分的所有控制器,它们都继承自 Utilisation::UtilisationController.我想为这些控制器设置默认布局utilisation/layouts/*.html.erb".

My application has all the controllers for the public part of the site scoped under the Utilisation module and they all inherit from the Utilisation::UtilisationController. I want to make the default layout for these controllers 'utilisation/layouts/*.html.erb'.

我尝试通过:

layout 'utilisation/layouts/application.html.erb'

但我明白

ActionView::MissingTemplate (Missing layout layouts/utilisation/application ...

如何更改默认布局目录?

How can I change the default layout directory ?

推荐答案

路径是相对于 layouts 文件夹的.试试:

The path is relative to layouts folder. Try:

layout '../utilisation/layouts/application' # without .html.erb is fine

这篇关于如何更改默认布局目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆