using alternate layout depending on action

This commit is contained in:
Dan Buch
2011-08-09 07:03:28 -04:00
parent 391a4c186f
commit 9d42948abe
5 changed files with 39 additions and 8 deletions

View File

@@ -1,15 +1,18 @@
class FooController < ApplicationController
layout 'bar', :except => 'count'
layout :figure_out_layout
def index
if request["die"]
throw Exception.new 'omg huh?'
end
def pretty
end
def figure_out_layout
if action_name =~ /pretty/
'pretty'
else
'standard'
end
end
def count
@data = [1,2,3]
render :layout => 'count'
end
end