diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index a19b5c95c7eba6b251007671fc2d51b3139d6176..172b7258ef6129989e3984c2b58c194f2ecbec7e 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -67,7 +67,7 @@ def html_safe? end end -class Fixnum +class Numeric def html_safe? true end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 7a8cda160dd1078bdeb62894860e12d9b76a8b55..0360cf2901b1854051d330963f0ed7f6a3af9f2a 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -353,6 +353,10 @@ def to_s test "A fixnum is safe by default" do assert 5.html_safe? end + + test "a float is safe by default" do + assert 5.7.html_safe? + end test "An object is unsafe by default" do assert !@object.html_safe?