开发者

Is there a way to available multiple "common layouts" in Rails 3.0? [Newbie]

开发者 https://www.devze.com 2023-02-10 10:24 出处:网络
I am working on an application which has two common_layouts for two different controllers. One controller works for my own website, and the other controller is for my client\'s website. I was shocked

I am working on an application which has two common_layouts for two different controllers. One controller works for my own website, and the other controller is for my client's website. I was shocked to see that this in RAILS 3.0 I cannot deploy two common_layouts. Relevant text is quoted below:

In previous versions of Rails, the rails gen开发者_开发问答erate scaffold command would automatically create a controller specific layout, like app/views/layouts/posts.html.erb, for the posts controller. However this has been changed in Rails 3.0. A application specific layout is used for all the controllers and can be found in app/views/layouts/application.html.erb

Am I mis-interpreting it over here or is it really a deprecation from previous version of Rails?


It's just saying that the scaffold command no longer generates those files. Having multiple layouts is fine, and they still automatically match controller names, just as they used to.


You misinterpreted it, you can easily use a cutom layout for a controller, just put this in your controller:

layout('my_controller_layout')
0

精彩评论

暂无评论...
验证码 换一张
取 消