diff --git a/actionview/lib/action_view/file_template.rb b/actionview/lib/action_view/file_template.rb index e0dc7da3b6..dea02176eb 100644 --- a/actionview/lib/action_view/file_template.rb +++ b/actionview/lib/action_view/file_template.rb @@ -11,7 +11,7 @@ module ActionView end def source - ::File.binread @filename + File.binread @filename end def refresh(_) diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb index 698f535b49..1faef9ca81 100644 --- a/actionview/lib/action_view/renderer/template_renderer.rb +++ b/actionview/lib/action_view/renderer/template_renderer.rb @@ -27,7 +27,7 @@ module ActionView Template::HTML.new(options[:html], formats.first) elsif options.key?(:file) if File.exist?(options[:file]) - Template::File.new(options[:file]) + Template::RawFile.new(options[:file]) else ActiveSupport::Deprecation.warn "render file: should be given the absolute path to a file" @lookup_context.with_fallbacks.find_file(options[:file], nil, false, keys, @details) diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index ebe52532d6..94f8a194a0 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -113,7 +113,7 @@ module ActionView eager_autoload do autoload :Error - autoload :File + autoload :RawFile autoload :Handlers autoload :HTML autoload :Inline diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb index aace0be04d..d0ea03e228 100644 --- a/actionview/lib/action_view/template/error.rb +++ b/actionview/lib/action_view/template/error.rb @@ -104,7 +104,7 @@ module ActionView def line_number @line_number ||= if file_name - regexp = /#{Regexp.escape ::File.basename(file_name)}:(\d+)/ + regexp = /#{Regexp.escape File.basename(file_name)}:(\d+)/ $1 if message =~ regexp || backtrace.find { |line| line =~ regexp } end end diff --git a/actionview/lib/action_view/template/file.rb b/actionview/lib/action_view/template/raw_file.rb similarity index 95% rename from actionview/lib/action_view/template/file.rb rename to actionview/lib/action_view/template/raw_file.rb index 487e5735cf..61818ba52f 100644 --- a/actionview/lib/action_view/template/file.rb +++ b/actionview/lib/action_view/template/raw_file.rb @@ -3,7 +3,7 @@ module ActionView #:nodoc: # = Action View File Template class Template #:nodoc: - class File #:nodoc: + class RawFile #:nodoc: attr_accessor :type, :format def initialize(filename)