Feature #42073 » fix-render_flash_messages-to-ignore-non-string-flash-values-and-prevent-errors.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
| 518 | 518 |
def render_flash_messages |
| 519 | 519 |
s = +'' |
| 520 | 520 |
flash.each do |k, v| |
| 521 |
next unless v.is_a?(String) |
|
| 522 | ||
| 521 | 523 |
s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
|
| 522 | 524 |
end |
| 523 | 525 |
s.html_safe |
| test/helpers/application_helper_test.rb | ||
|---|---|---|
| 2403 | 2403 |
assert_equal expected, format_activity_description(text) |
| 2404 | 2404 |
end |
| 2405 | 2405 | |
| 2406 |
def test_render_flash_messages_should_ignore_non_string_values |
|
| 2407 |
flash[:array_value] = ['1', '2'] |
|
| 2408 |
flash[:hash_value] = { foo: 'bar' }
|
|
| 2409 | ||
| 2410 |
result = render_flash_messages |
|
| 2411 |
assert_equal '', result |
|
| 2412 |
end |
|
| 2413 | ||
| 2406 | 2414 |
private |
| 2407 | 2415 | |
| 2408 | 2416 |
def wiki_links_with_special_characters |
- « Previous
- 1
- 2
- 3
- Next »