After developing a mobile interface for my application, using the techniques described on the mailing list regarding themeable views, I am stuck in when it comes time for production. It all works in development mode since Rails reloads everything. But in production mode t he wrong templates are still served even though the template_root is updated in the application controller correctly. The trigger to switch views is the first segment of the URL (http:// www.example.com/mobile/). Obviously I am missing something or taking the wrong approach. I know backpackit.com does serves up a mobile interface in a similar manner. Can anyone shed light on the proper way to server 2 different views for the same controllers/models? -- Lon Baker Speedymac LLC http://www.speedymac.com AIM: spdemac Skype: spdemac
Lon Baker wrote:> > Can anyone shed light on the proper way to server 2 different views > for the same controllers/models? >I would write a render interceptor that extended the path used to locate the template. module MediaTypeSensitiveHelpers def render(template, *args) super("#{params[:media_type] || common}/#{template}", *args) end protected :render end class MyController include MediaTypeSensitiveHelpers ... end I''m not sure if that code will work exactly as expected, but hopefully it sets you on the right track. POPULATION EXPLOSION Unique in human experience, an event which happened yesterday but which everyone swears won''t happen until tomorrow. - The Hipcrime Vocab by Chad C. Mulligan