Indeed! That did it.
If I were to tweak the code such that it looks for layouts in sub-folder first and falls back to $approot/views/layouts, what would be the best way?
Here's my attempt in config.rb
class << self
def fetch_layout_path(given_layout=nil)
layout_name = given_layout || @layout || :application
puts "============ #{layout_name}"
@_cached_layout ||= {}
cached_layout_path = @_cached_layout[layout_name]
return cached_layout_path if cached_layout_path
has_layout_at_root = Dir["#{views}/#{layout_name}.*"].any?
layout_path = has_layout_at_root ? layout_name.to_sym : File.join('layouts', layout_name.to_s).to_sym
@_cached_layout[layout_name] = layout_path unless reload_templates?
layout_path
end
endHowever, I do not know how to get the current file being rendered (case11/case_11_1.html.erb) so that I extract current folder (case11). Any hint?
Ultimately, my goals is to create a git repo for the entire site and have folks add cases by just dropping a self-contained folder underneath views. A git hook will invoke mm-build and push the resulting site.
Thanks,
Amitava