0

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

Ben Hall
  • 1,927
  • 5
  • 25
  • 39

2 Answers2

0

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

Andy Gaskell
  • 31,495
  • 6
  • 74
  • 83
0

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.

Community
  • 1
  • 1
ryanb
  • 16,227
  • 5
  • 51
  • 46
  • The reason is because I don't want my directories to be /movies /new.html.erb /new.iphone.erb /new.wm.erb /new.js.erb Wanted to try and separate them out a little bit into subfolders... – Ben Hall Aug 16 '09 at 17:53