diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-10 12:57:44 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-10 15:45:46 -0700 |
commit | e6ac56a848eb253a2162d7b18ad6380af22971bd (patch) | |
tree | 075a7005474e9af32e5a72803c32a670373af35d /activerecord | |
parent | 2ee2072bbaa3a3694cca8edd4e02cc90e175fc1e (diff) | |
download | rails-e6ac56a848eb253a2162d7b18ad6380af22971bd.tar.gz rails-e6ac56a848eb253a2162d7b18ad6380af22971bd.tar.bz2 rails-e6ac56a848eb253a2162d7b18ad6380af22971bd.zip |
Stop passing a column to `quote` when prepared statements are turned off
I'm planning on deprecating the column argument to mirror the
deprecation in [arel].
[arel]: https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index fb68ad17b2..1f265a55df 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -90,9 +90,7 @@ module ActiveRecord value.to_s(:db) end - private - - def prepare_binds_for_database(binds) + def prepare_binds_for_database(binds) # :nodoc: binds.map do |column, value| if column column_name = column.name @@ -102,6 +100,8 @@ module ActiveRecord end end + private + def types_which_need_no_typecasting [nil, Numeric, String] end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index e52b666296..c941c9f1eb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -113,7 +113,8 @@ module ActiveRecord class BindCollector < Arel::Collectors::Bind def compile(bvs, conn) - super(bvs.map { |bv| conn.quote(*bv.reverse) }) + casted_binds = conn.prepare_binds_for_database(bvs) + super(casted_binds.map { |_, value| conn.quote(value) }) end end |