Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Detached Mongrel server renders no layout

#1803

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/**/*"] }
end

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:


Dir["#{path.path}/layouts/**/*"]

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
  begin
    Dir.chdir("/") do
      ProductController.view_paths = [ File.dirname(__FILE__) + '/../fixtures/layout_tests/' ]
      @controller = ProductController.new
      get :hello
      assert_equal 'layout_test.rhtml hello.rhtml', @response.body
    end
  ensure
    ProductController.view_paths = old_load_paths
  end
end

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.

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

State: resolved
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. josh
    josh
    • Milestone cleared.
    • State changed from new to open

    January 27th, 2009 @ 03:29 PM

  2. Repository
    Repository
    • State changed from open to resolved

    (from [a1ac635d9655cd26f86593263c3e9b956d330141]) Ensure the full path is used when searching for layouts [#1803 Detached Mongrel server renders no layout state:resolved] http://github.com/rails/rails/co...

    January 27th, 2009 @ 05:06 PM