diff --git a/cookbook/015/hodgepodge/app/controllers/foo_controller.rb b/cookbook/015/hodgepodge/app/controllers/foo_controller.rb index 64959f8..4a38782 100644 --- a/cookbook/015/hodgepodge/app/controllers/foo_controller.rb +++ b/cookbook/015/hodgepodge/app/controllers/foo_controller.rb @@ -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 diff --git a/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb b/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb new file mode 100644 index 0000000..bfdd816 --- /dev/null +++ b/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/foo/pretty.html.erb
diff --git a/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb b/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb new file mode 100644 index 0000000..945a4c4 --- /dev/null +++ b/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb @@ -0,0 +1,15 @@ + + + +