lib/stache/mustache/handler.rb in stache-1.0.0.rc vs lib/stache/mustache/handler.rb in stache-1.0.0
- old
+ new
@@ -23,11 +23,11 @@
# If we are rendering an abstract Stache::View class, don't render any template.
if #{mustache_class} == Stache::Mustache::View
template_source = '#{template.source.gsub(/'/, "\\\\'")}'
else
- template_name = mustache.template_name+".#{template.formats.first.to_s}."+mustache.template_extension
+ template_name = "#{template.virtual_path.to_s}.#{template.formats.first.to_s}."+mustache.template_extension
template_source = File.read(File.join(::Stache.template_base_path, template_name))
end
mustache.template = template_source
mustache.virtual_path = '#{template.virtual_path.to_s}'
@@ -66,9 +66,10 @@
if template.source.empty?
return Stache::Mustache::View
end
const_name = ActiveSupport::Inflector.camelize(template.virtual_path.to_s)
+ const_name = "#{Stache.wrapper_module_name}::#{const_name}" if Stache.wrapper_module_name
begin
const_name.constantize
rescue NameError, LoadError => e
# Only rescue NameError/LoadError concerning our mustache_class
if e.message.match(/#{const_name}$/)