Created
January 21, 2009 04:00
-
-
Save royw/49845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Merb::Template | |
class << self | |
# overwrite the load_template_io to look in app/views/templates if the | |
# given path is not found | |
def load_template_io(path) | |
io = super | |
Merb.logger.debug "Merb's load_template_io(#{path}) => #{io.inspect}" | |
if io.nil? | |
if path =~ %r((.*/app/views/).*(/[^/]+)$) | |
template_path = $1 + 'templates' + $2 | |
file = Dir["#{template_path}.{#{template_extensions.join(',')}}"].first | |
io = File.open(file, "r") if file | |
Merb.logger.debug "App's load_template_io(#{template_path}) => #{io.inspect}" | |
end | |
end | |
io | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment