diff options
author | Richard Schneeman <richard.schneeman@gmail.com> | 2016-02-16 14:54:34 -0600 |
---|---|---|
committer | Richard Schneeman <richard.schneeman@gmail.com> | 2016-02-16 14:54:34 -0600 |
commit | ac317e778a959468ef07779a4959ad49e8e9bbd6 (patch) | |
tree | 5b9ff800e44bdbc0d5a8430ff080d267680cd553 /actionview | |
parent | b0b61b62f9c27eff5b9e0797a0de0d35d64d1620 (diff) | |
parent | 632938cfda8762a98a7c7a360a6f05c29d2cdb5e (diff) | |
download | rails-ac317e778a959468ef07779a4959ad49e8e9bbd6.tar.gz rails-ac317e778a959468ef07779a4959ad49e8e9bbd6.tar.bz2 rails-ac317e778a959468ef07779a4959ad49e8e9bbd6.zip |
Merge pull request #23203 from vipulnsward/22979-show-tags-on-exception
WIP: Errors in logs should show log tags as well.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/template/error.rb | 4 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb index ccee785d3e..3f38c3d2b9 100644 --- a/actionview/lib/action_view/template/error.rb +++ b/actionview/lib/action_view/template/error.rb @@ -135,13 +135,13 @@ module ActionView end def formatted_code_for(source_code, line_counter, indent, output) - start_value = (output == :html) ? {} : "" + start_value = (output == :html) ? {} : [] source_code.inject(start_value) do |result, line| line_counter += 1 if output == :html result.update(line_counter.to_s => "%#{indent}s %s\n" % ["", line]) else - result << "%#{indent}s: %s\n" % [line_counter, line] + result << "%#{indent}s: %s" % [line_counter, line] end end end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 333e0cca11..bf811abdd0 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -226,13 +226,13 @@ module RenderTestCases assert_match %r!method.*doesnt_exist!, e.message assert_equal "", e.sub_template_message assert_equal "1", e.line_number - assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code.strip + assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end def test_render_error_indentation e = assert_raises(ActionView::Template::Error) { @view.render(:partial => "test/raise_indentation") } - error_lines = e.annoted_source_code.split("\n") + error_lines = e.annoted_source_code assert_match %r!error\shere!, e.message assert_equal "11", e.line_number assert_equal " 9: <p>Ninth paragraph</p>", error_lines.second @@ -252,7 +252,7 @@ module RenderTestCases assert_match %r!method.*doesnt_exist!, e.message assert_equal "", e.sub_template_message assert_equal "1", e.line_number - assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code.strip + assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end |