开发者

Rails view templates in subdirectories

开发者 https://www.devze.com 2023-02-06 19:52 出处:网络
Is it possible to make rails automatically look in certain sub-directories for a view-template? I have different formats on my page (html, iphone, android, js and so on..) and the views directories a

Is it possible to make rails automatically look in certain sub-directories for a view-template?

I have different formats on my page (html, iphone, android, js and so on..) and the views directories are starting to be a 开发者_StackOverflow中文版real mess. I would like rails to automatically look for templates in /html /iphone and so on and fall back to the normal directory if it can't find it. So for example, if the format is iphone, it will first look in /views/users/iphone/index.iphone.haml and if it can't find it, it will look for /views/users/index.iphone.haml.


http://www.axehomeyg.com/2009/06/10/view-path-manipulation-for-rails-with-aop/

Yes you can.

0

精彩评论

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