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
You may want to extend the
view_pathsso 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.