Web and Mobile views best practices same controller or namespace?

﹥>﹥吖頭↗ 提交于 2020-01-13 09:58:29

问题


Im looking for the guidance on best practices for developing a web app with normal views and mobile views. The mobile version would have less of the functionality but a whole lot of view files.

Is it a better idea to separate the whole application into two projects, or to create a namespace? Or simple to keep everything inside of the single set of controllers?


回答1:


Unless the functionality is drastically different, I'd leave the app as it is and create a mobile responder that would render the mobile site's pages.

respond_to :mobile { #render mobile view here }

The reason for this is that you'd be copying code into another namespace and therefore causing yourself maintainability headaches. However, if the functionality is very different, go ahead and create a namespace for the mobile site.



来源:https://stackoverflow.com/questions/5293173/web-and-mobile-views-best-practices-same-controller-or-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!