diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-07-28 10:36:10 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-28 10:36:10 -0300 |
commit | fb30df9c10372b1667dabac2fffe2cff25302626 (patch) | |
tree | 7af7a24321aeecb4b6cfee000ec5254a860ead00 /activerecord/lib/active_record | |
parent | be85efe8db42edb50a4f90e9f39f069bb5479b8e (diff) | |
parent | 5465508abe9ab49ccc01d2a9b43c5cfc2a70aea5 (diff) | |
download | rails-fb30df9c10372b1667dabac2fffe2cff25302626.tar.gz rails-fb30df9c10372b1667dabac2fffe2cff25302626.tar.bz2 rails-fb30df9c10372b1667dabac2fffe2cff25302626.zip |
Merge pull request #25937 from kamipo/remove_prepare_binds_for_database
Remove `prepare_binds_for_database` internal method
Diffstat (limited to 'activerecord/lib/active_record')
4 files changed, 4 insertions, 8 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 621f737a5e..e667e16964 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -316,7 +316,7 @@ module ActiveRecord end end key_list = fixture.keys.map { |name| quote_column_name(name) } - value_list = prepare_binds_for_database(binds).map do |value| + value_list = binds.map(&:value_for_database).map do |value| begin quote(value) rescue TypeError diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index 0a58921549..eda6af08e3 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -150,10 +150,6 @@ module ActiveRecord quoted_date(value).sub(/\A2000-01-01 /, '') end - def prepare_binds_for_database(binds) # :nodoc: - binds.map(&:value_for_database) - end - private def type_casted_binds(binds) diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 4f8490fa2b..0b8bacff4e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -130,7 +130,7 @@ module ActiveRecord class BindCollector < Arel::Collectors::Bind def compile(bvs, conn) - casted_binds = conn.prepare_binds_for_database(bvs) + casted_binds = bvs.map(&:value_for_database) super(casted_binds.map { |value| conn.quote(value) }) end end diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index 5607be6d12..8a29547bda 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -49,8 +49,8 @@ module ActiveRecord def sql_for(binds, connection) val = @values.dup - binds = connection.prepare_binds_for_database(binds) - @indexes.each { |i| val[i] = connection.quote(binds.shift) } + casted_binds = binds.map(&:value_for_database) + @indexes.each { |i| val[i] = connection.quote(casted_binds.shift) } val.join end end |