问题
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