specifying separate layouts within controllers and methods
This commit is contained in:
parent
c16c1361d3
commit
3f5e481906
@ -1,5 +1,12 @@
|
||||
class FooController < ApplicationController
|
||||
layout 'bar'
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def count
|
||||
@data = [1,2,3]
|
||||
render :layout => 'count'
|
||||
end
|
||||
|
||||
end
|
||||
|
2
cookbook/015/hodgepodge/app/views/foo/count.html.erb
Normal file
2
cookbook/015/hodgepodge/app/views/foo/count.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>Foo#count</h1>
|
||||
<p>Find me in app/views/foo/count.html.erb</p>
|
9
cookbook/015/hodgepodge/app/views/layouts/bar.html.erb
Normal file
9
cookbook/015/hodgepodge/app/views/layouts/bar.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>BAR :: My Website - <%= @title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
9
cookbook/015/hodgepodge/app/views/layouts/count.html.erb
Normal file
9
cookbook/015/hodgepodge/app/views/layouts/count.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>COUNT :: My Website - <%= @title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,6 @@
|
||||
Hodgepodge::Application.routes.draw do
|
||||
get "foo/count"
|
||||
|
||||
get "foo/index"
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
|
Loading…
Reference in New Issue
Block a user