diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/layout_test.rb | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index ceee5e72d1..f16d90af69 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Allow layouts with extension of .html.erb. Closes #8032 [Josh Knowles] + * Change default respond_to templates for xml and rjs formats. [Rick] * Default xml template goes from #{action_name}.rxml => #{action_name}.xml.builder. diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index ca070d0577..7de66cd66e 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -190,7 +190,7 @@ module ActionController #:nodoc: def inherited_with_layout(child) inherited_without_layout(child) layout_match = child.name.underscore.sub(/_controller$/, '').sub(/^controllers\//, '') - child.layout(layout_match) unless child.layout_list.grep(%r{layouts/#{layout_match}\.[a-z][0-9a-z]*$}).empty? + child.layout(layout_match) unless child.layout_list.grep(%r{layouts/#{layout_match}(\.[a-z][0-9a-z]*)+$}).empty? end def add_layout_conditions(conditions) diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index edf8f44b3a..5689ed0711 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -28,6 +28,9 @@ end class ControllerNameSpace::NestedController < LayoutTest end +class MultipleExtensions < LayoutTest +end + class MabView def initialize(view) end @@ -72,6 +75,13 @@ class LayoutAutoDiscoveryTest < Test::Unit::TestCase assert_equal 'layouts/controller_name_space/nested', @controller.active_layout assert_equal 'controller_name_space/nested.rhtml hello.rhtml', @response.body end + + def test_namespaced_controllers_auto_detect_layouts + @controller = MultipleExtensions.new + get :hello + assert_equal 'layouts/multiple_extensions', @controller.active_layout + assert_equal 'multiple_extensions.html.erb hello.rhtml', @response.body.strip + end end class ExemptFromLayoutTest < Test::Unit::TestCase |