From dc57d545bb3e8ff4123892e5e311e658ab506252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 26 Jan 2010 20:43:35 +0100 Subject: Fix t('.helper'). --- actionpack/lib/action_view/template/resolver.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_view/template') diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index c6a17907ff..340a6afe5e 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -117,15 +117,18 @@ module ActionView # # :api: plugin def path_to_details(path) # [:erb, :format => :html, :locale => :en, :partial => true/false] - if m = path.match(%r'(?:^|/)(_)?[\w-]+((?:\.[\w-]+)*)\.(\w+)$') - partial = m[1] == '_' - details = (m[2]||"").split('.').reject { |e| e.empty? } - handler = Template.handler_class_for_extension(m[3]) + if m = path.match(%r'((^|.*/)(_)?[\w-]+)((?:\.[\w-]+)*)\.(\w+)$') + partial = m[3] == '_' + details = (m[4]||"").split('.').reject { |e| e.empty? } + handler = Template.handler_class_for_extension(m[5]) format = Mime[details.last] && details.pop.to_sym locale = details.last && details.pop.to_sym - return handler, :format => format, :locale => locale, :partial => partial + virtual_path = (m[1].gsub("#{@path}/", "") << details.join(".")) + + return handler, :format => format, :locale => locale, :partial => partial, + :virtual_path => virtual_path end end end -- cgit v1.2.3