This project is archived and is in readonly mode.

#1803 ✓resolved

Detached Mongrel server renders no layout

Reported by Mislav | January 27th, 2009 @ 12:25 PM

Detached Mongrel server cannot seem to find an implicit layout and therefore renders actions without a layout.

This is a regression from commit 858a420c.

I narrowed it down to this method:

# action_controller/layout.rb

def layout_list
  Array(view_paths).sum([]) { |path| Dir["#{path}/layouts/**/*"] }

With detached Mongrel this method returns an empty array because the current working dir is "/" (root), but Path#to_s returns a relative path since it strips RAILS_ROOT from the beginning (why?!).

The fix is this glob:


I haven't been able to produce a failing test. I tried something like:

# this test simulates a detached Mongrel server
def test_application_layout_is_found_with_absolute_paths
  old_load_paths = ProductController.view_paths
    Dir.chdir("/") do
      ProductController.view_paths = [ File.dirname(__FILE__) + '/../fixtures/layout_tests/' ]
      @controller =
      get :hello
      assert_equal 'layout_test.rhtml hello.rhtml', @response.body
    ProductController.view_paths = old_load_paths

but I seem to be on the wrong track, I just keep getting unrelated errors and can't really get an action to render without a layout.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket

Referenced by