/
InheritViews.html
87 lines (84 loc) · 4.13 KB
/
InheritViews.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<title>Module: InheritViews [inherit_views API Docs (b551fbb)]</title>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
<link href='.././rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
//<![CDATA[
function popupCode(url) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode(id) {
var code = document.getElementById(id)
code.style.display = code.style.display != 'block' ? 'block' : 'none'
return true
}
// Make codeblocks hidden by default
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
//]]>
</script>
</head>
<body class='page'>
<div class='class' id='wrapper'>
<div class='header'>
<h1 class='name'>
<span class='type'>Module</span>
InheritViews
</h1>
<ol class='paths'>
<li>
<a href="../files/lib/inherit_views_rb.html">lib/inherit_views.rb</a>
</li>
</ol>
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<p>
Allow your controllers to inherit their views from parent controllers, or
from specified view paths.
</p>
<h3>Example</h3>
<pre>class FooController < ApplicationController
 inherit_views
end

class BarController < FooController
 ... # will look for views in 'views/bar' and 'views/foo'
end</pre>
<p>
In the example above, If BarController, or any of the views in views/bar,
renders ‘bar/view’ and it is not found then
‘foo/view’ is rendered (if it can be found)
</p>
<p>
You can also specify an inherit path other than the default (it does not
have to be the default controller path) If your controller inherits from a
controller with inherit_views then that controller gets the inherited view
paths as well.
</p>
<pre>class FooController < ApplicationController
 inherit_views 'far', 'faz' # will look for views in 'foo', then 'far', then 'faz'
end

class BarController < FooController
 # will look for views in 'bar', 'foo', 'far', 'faz'
end</pre>
<p>
If you want to turn off inherited views for a controller that has
inherit_views in its ancestors use self.inherit_views=
</p>
<pre>class BarController < FooController
 self.inherit_views = false
end</pre>
<p>
You can completely override the inherited view paths in a subclass
controller using inherit_view_paths=
</p>
<pre>class BarController < FooController
 self.inherit_view_paths = ['you_can_go', 'your_own_way']
 # will look for views in 'bar', 'you_can_go', and 'your_own_way'
 # (not 'far' or 'faz' from FooController)
end</pre>
</div>
<div id='section'>
<div id='class-list'>
<h2>Classes and Modules</h2>
Module <a href="InheritViews/ActMethod.html" class="link">InheritViews::ActMethod</a><br />
Module <a href="InheritViews/ActionView.html" class="link">InheritViews::ActionView</a><br />
Module <a href="InheritViews/PathsContainer.html" class="link">InheritViews::PathsContainer</a><br />
Class <a href="InheritViews/PathSet.html" class="link">InheritViews::PathSet</a><br />
</div>
</div>
</div>
</div>
<div id='footer-push'></div>
</div>
<div id='footer'>
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
</div>
</body>
</html>