diff options
author | Daniel Colson <danieljamescolson@gmail.com> | 2018-01-29 07:22:42 -0500 |
---|---|---|
committer | Daniel Colson <danieljamescolson@gmail.com> | 2018-01-29 07:22:42 -0500 |
commit | 2e8c8d60e7568f9fb82fbed26d86c45d3cf82232 (patch) | |
tree | 908fcb1c16474887a4f49985754b1be4e20c603f /activerecord/lib/active_record/sanitization.rb | |
parent | bee764965e80b0f4f0a15c31b340f245779a7d89 (diff) | |
download | rails-2e8c8d60e7568f9fb82fbed26d86c45d3cf82232.tar.gz rails-2e8c8d60e7568f9fb82fbed26d86c45d3cf82232.tar.bz2 rails-2e8c8d60e7568f9fb82fbed26d86c45d3cf82232.zip |
Avoid extra calls to to_s
With #31615 `type_for_attribute` accepts either
a symbol as well as a string. `has_attribute?` and `attribute_alias`
also accept either. Since these methods call `to_s` on the argument,
we no longer need to do that at the call site.
Diffstat (limited to 'activerecord/lib/active_record/sanitization.rb')
-rw-r--r-- | activerecord/lib/active_record/sanitization.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/sanitization.rb b/activerecord/lib/active_record/sanitization.rb index 173794b8f4..4947e8d132 100644 --- a/activerecord/lib/active_record/sanitization.rb +++ b/activerecord/lib/active_record/sanitization.rb @@ -84,7 +84,7 @@ module ActiveRecord def sanitize_sql_hash_for_assignment(attrs, table) c = connection attrs.map do |attr, value| - type = type_for_attribute(attr.to_s) + type = type_for_attribute(attr) value = type.serialize(type.cast(value)) "#{c.quote_table_name_for_assignment(table, attr)} = #{c.quote(value)}" end.join(", ") |