/
app.rb
32 lines (26 loc) · 1009 Bytes
/
app.rb
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
class InheritViewsTestController < ActionController::Base
self.view_paths = [File.join(File.dirname(__FILE__), 'views_for_specs')]
end
# :a controller is a normal controller with inherit_views
# its subclasses will inherit its views
class AController < InheritViewsTestController
inherit_views
def render_non_existent_template
render :action => 'non_existent'
end
end
# :b controller is a normal controller with inherit_views 'a'
# It will inherit a's views, and its sublcasses will inherit its views ('b', then 'a')
class BController < InheritViewsTestController
inherit_views 'a'
end
# :c cotroller is a subclass of :b controller, so it inheirt's b's views ('c', 'b', then 'a')
class CController < BController
end
# :d controller is a subclass of :a controller, with inherit_views 'other', so its views == ('d', 'other', then 'a')
class DController < AController
inherit_views 'other'
end
# used to test normal rails behaviour
class NormalController < InheritViewsTestController
end