Skip to content

Instantly share code, notes, and snippets.

@royw
Created January 21, 2009 04:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royw/49845 to your computer and use it in GitHub Desktop.
Save royw/49845 to your computer and use it in GitHub Desktop.
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