- Create a controller with a module: Foo::BarController
- Create a directory anywhere: ~/foo
- symlink that dir to app/views/layouts/foo in your app
- In thar dir, put a layout file with some noticeable content and a detectable name: bar.html.erb
expected: the layout file to be found regardlessly of being in a symlinked or real dir.
observed: layout is not found.
This is because Dir::glob does not traverse symlinks, so the layout_list method fails to locate the files.
This can be patched by traversing the symlinks manually. Here's how I redefined the layout_list method:
def layout_list(path = nil) #:nodoc:
return view_paths.map{ |view_path| layout_list(view_path) }.flatten if path.nil?
Dir["#{path}/**/*"].inject([]) do |r, path|
r << path
r += layout_list(path) if File.symlink? path
r
end
end
All AP tests pass with this change. I have plans to make a test case, but don't have the time right now. If anyone feels like jumping in...