Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6516

Show
Ignore:
Timestamp:
04/12/07 17:11:48 (2 years ago)
Author:
rick
Message:

Allow layouts with extension of .html.erb. Closes #8032 [Josh Knowles]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r6508 r6516  
    11*SVN* 
     2 
     3* Allow layouts with extension of .html.erb.  Closes #8032 [Josh Knowles] 
    24 
    35* Change default respond_to templates for xml and rjs formats. [Rick] 
  • trunk/actionpack/lib/action_controller/layout.rb

    r6396 r6516  
    191191          inherited_without_layout(child) 
    192192          layout_match = child.name.underscore.sub(/_controller$/, '').sub(/^controllers\//, '') 
    193           child.layout(layout_match) unless child.layout_list.grep(%r{layouts/#{layout_match}\.[a-z][0-9a-z]*$}).empty? 
     193          child.layout(layout_match) unless child.layout_list.grep(%r{layouts/#{layout_match}(\.[a-z][0-9a-z]*)+$}).empty? 
    194194        end 
    195195 
  • trunk/actionpack/test/controller/layout_test.rb

    r6178 r6516  
    2929end 
    3030 
     31class MultipleExtensions < LayoutTest 
     32end 
     33 
    3134class MabView 
    3235  def initialize(view) 
     
    7275    assert_equal 'layouts/controller_name_space/nested', @controller.active_layout 
    7376    assert_equal 'controller_name_space/nested.rhtml hello.rhtml', @response.body 
     77  end 
     78   
     79  def test_namespaced_controllers_auto_detect_layouts 
     80    @controller = MultipleExtensions.new 
     81    get :hello 
     82    assert_equal 'layouts/multiple_extensions', @controller.active_layout 
     83    assert_equal 'multiple_extensions.html.erb hello.rhtml', @response.body.strip 
    7484  end 
    7585end