diff options
-rw-r--r-- | actionpack/lib/action_view/template.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index b9d5b4e70f..a999a0b7d7 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -1,5 +1,6 @@ require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/object/try' require 'active_support/core_ext/kernel/singleton_class' module ActionView @@ -117,9 +118,7 @@ module ActionView format = details[:format] || :html @formats = Array.wrap(format).map(&:to_sym) - - @virtual_path = details[:virtual_path] - @virtual_path.sub(".#{format}", "") if @virtual_path + @virtual_path = details[:virtual_path].try(:sub, ".#{format}", "") end def render(view, locals, &block) |