specifying separate layouts within controllers and methods

This commit is contained in:
Dan Buch 2011-08-09 06:41:10 -04:00
parent c16c1361d3
commit 3f5e481906
6 changed files with 32 additions and 3 deletions

View File

@ -1,5 +1,12 @@
class FooController < ApplicationController class FooController < ApplicationController
layout 'bar'
def index def index
end end
def count
@data = [1,2,3]
render :layout => 'count'
end
end end

View File

@ -0,0 +1,2 @@
<h1>Foo#count</h1>
<p>Find me in app/views/foo/count.html.erb</p>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>BAR :: My Website - <%= @title %></title>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>COUNT :: My Website - <%= @title %></title>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -1,4 +1,6 @@
Hodgepodge::Application.routes.draw do Hodgepodge::Application.routes.draw do
get "foo/count"
get "foo/index" get "foo/index"
# The priority is based upon order of creation: # The priority is based upon order of creation: