views:

43

answers:

2

Hello,

I'm trying to separate the views for the different platforms into different subfolders.

I have done this for the layout, at the moment I have the following:

class MoviesController < ApplicationController
   layout :site_layout

   def site_layout
      if(iphone_request?)
         "iPhone/movies"
      else
         "movies"
   end

This means that in my action methods I don't need to include :layout, however I do still need to manually include the path to the template.

format.iphone {render :template => 'movies/iPhone/index'}

Is there a way to have the same kind of layout declaration but for templates?

Thanks

Ben

A: 

I might be off, but maybe it'll help - try checking prepend_view_path.

Andy Gaskell
A: 

You may want to extend the view_paths so that you can have a special iphone subfolder under views and override templates as necessary. See this tutorial on how to do that.

However, is there a reason you don't want to use the iphone format in the view name (show.iphone.erb) instead of making a subfolder? See martinkl's answer in your other question for details.

ryanb
The reason is because I don't want my directories to be /movies /new.html.erb /new.iphone.erb /new.wm.erb /new.js.erbWanted to try and separate them out a little bit into subfolders...
Ben Hall