diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-06-21 14:26:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-21 14:26:44 -0400 |
commit | b1bde1f2a4a588480ca7f0349eb74e8893638eb3 (patch) | |
tree | 5cc0eaed794ba0f298eaaac9663f0e5eb2ffa05a /activerecord | |
parent | 0c32bbd240ec8bcb56a60951a3a1c9ae2017240a (diff) | |
parent | fa14332ad202dcc941a6dc3863d606e3f3f6e851 (diff) | |
download | rails-b1bde1f2a4a588480ca7f0349eb74e8893638eb3.tar.gz rails-b1bde1f2a4a588480ca7f0349eb74e8893638eb3.tar.bz2 rails-b1bde1f2a4a588480ca7f0349eb74e8893638eb3.zip |
Merge pull request #29513 from kirs/fixture-yaml-fallback
Avoid begin/rescue in fixture quoting
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index dc766ce4fc..af5314c1d6 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -425,12 +425,11 @@ module ActiveRecord # are not quotable. In this case we want to convert # the column value to YAML. def with_yaml_fallback(value) - begin - quote(value) - rescue TypeError - value = YAML.dump(value) + if value.is_a?(Hash) || value.is_a?(Array) + YAML.dump(value) + else + value end - value end end end |