Permalink
Browse files

Remove deprecated support to passing a column to #quote

  • Loading branch information...
1 parent 41e177e commit e646bad5b7c462187fc75c11d5c06e43759022d8 @rafaelfranca rafaelfranca committed Dec 29, 2016
View
@@ -7,6 +7,8 @@ end
gemspec
+gem "arel", github: "rails/arel"
+
# We need a newish Rake since Active Job sets its test tasks' descriptions.
gem "rake", ">= 11.1"
View
@@ -39,6 +39,12 @@ GIT
websocket
GIT
+ remote: https://github.com/rails/arel.git
+ revision: b26638ef041953992010590b31615c519fa0ea7d
+ specs:
+ arel (8.0.0)
+
+GIT
remote: https://github.com/resque/resque.git
revision: 835a4a7e61a2e33832dbf11975ecfab54af293c6
specs:
@@ -83,7 +89,7 @@ PATH
activerecord (5.1.0.alpha)
activemodel (= 5.1.0.alpha)
activesupport (= 5.1.0.alpha)
- arel (~> 7.0)
+ arel (~> 8.0)
activesupport (5.1.0.alpha)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
@@ -114,7 +120,6 @@ GEM
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
amq-protocol (2.0.1)
- arel (7.1.4)
ast (2.3.0)
backburner (1.3.1)
beaneater (~> 1.0)
@@ -193,6 +198,8 @@ GEM
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.9.14)
+ ffi (1.9.14-x64-mingw32)
+ ffi (1.9.14-x86-mingw32)
globalid (0.3.7)
activesupport (>= 4.1.0)
hiredis (0.6.1)
@@ -373,6 +380,7 @@ DEPENDENCIES
activerecord-jdbcmysql-adapter (>= 1.3.0)
activerecord-jdbcpostgresql-adapter (>= 1.3.0)
activerecord-jdbcsqlite3-adapter (>= 1.3.0)
+ arel!
backburner
bcrypt (~> 3.1.11)
benchmark-ips
@@ -1,3 +1,7 @@
+* Remove deprecated support to passing a column to `#quote`.
+
+ *Rafael Mendonça França*
+
* Set `:time` as a timezone aware type and remove deprecation when the values is not
explictly set.
@@ -24,5 +24,5 @@ Gem::Specification.new do |s|
s.add_dependency "activesupport", version
s.add_dependency "activemodel", version
- s.add_dependency "arel", "~> 7.0"
+ s.add_dependency "arel", "~> 8.0"
end
@@ -5,20 +5,10 @@ module ConnectionAdapters # :nodoc:
module Quoting
# Quotes the column value to help prevent
# {SQL injection attacks}[http://en.wikipedia.org/wiki/SQL_injection].
- def quote(value, column = nil)
+ def quote(value)
# records are quoted as their primary key
return value.quoted_id if value.respond_to?(:quoted_id)
- if column
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Passing a column to `quote` has been deprecated. It is only used
- for type casting, which should be handled elsewhere. See
- https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
- for more information.
- MSG
- value = type_cast_from_column(column, value)
- end
-
_quote(value)
end
@@ -82,46 +82,46 @@ def test_quoted_datetime_local
end
def test_quote_with_quoted_id
- assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1), nil)
+ assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1))
end
def test_quote_nil
- assert_equal "NULL", @quoter.quote(nil, nil)
+ assert_equal "NULL", @quoter.quote(nil)
end
def test_quote_true
- assert_equal @quoter.quoted_true, @quoter.quote(true, nil)
+ assert_equal @quoter.quoted_true, @quoter.quote(true)
end
def test_quote_false
- assert_equal @quoter.quoted_false, @quoter.quote(false, nil)
+ assert_equal @quoter.quoted_false, @quoter.quote(false)
end
def test_quote_float
float = 1.2
- assert_equal float.to_s, @quoter.quote(float, nil)
+ assert_equal float.to_s, @quoter.quote(float)
end
def test_quote_integer
integer = 1
- assert_equal integer.to_s, @quoter.quote(integer, nil)
+ assert_equal integer.to_s, @quoter.quote(integer)
end
def test_quote_bignum
bignum = 1 << 100
- assert_equal bignum.to_s, @quoter.quote(bignum, nil)
+ assert_equal bignum.to_s, @quoter.quote(bignum)
end
def test_quote_bigdecimal
bigdec = BigDecimal.new((1 << 100).to_s)
- assert_equal bigdec.to_s("F"), @quoter.quote(bigdec, nil)
+ assert_equal bigdec.to_s("F"), @quoter.quote(bigdec)
end
def test_dates_and_times
@quoter.extend(Module.new { def quoted_date(value) "lol" end })
- assert_equal "'lol'", @quoter.quote(Date.today, nil)
- assert_equal "'lol'", @quoter.quote(Time.now, nil)
- assert_equal "'lol'", @quoter.quote(DateTime.now, nil)
+ assert_equal "'lol'", @quoter.quote(Date.today)
+ assert_equal "'lol'", @quoter.quote(Time.now)
+ assert_equal "'lol'", @quoter.quote(DateTime.now)
end
def test_quoting_classes
@@ -131,7 +131,7 @@ def test_quoting_classes
def test_crazy_object
crazy = Object.new
e = assert_raises(TypeError) do
- @quoter.quote(crazy, nil)
+ @quoter.quote(crazy)
end
assert_equal "can't quote Object", e.message
end
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "action_controller/railtie"
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "active_job"
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
gem "sqlite3"
end
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
gem "sqlite3"
end
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
gem "benchmark-ips"
end
@@ -8,6 +8,7 @@
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "active_support"
@@ -246,6 +246,7 @@ def version
def rails_gemfile_entry
dev_edge_common = [
+ GemfileEntry.github("arel", "rails/arel")
]
if options.dev?
[
@@ -6,17 +6,10 @@ class BinSetupTest < ActiveSupport::TestCase
def setup
build_app
-
- create_gemfile
- update_boot_file_to_use_bundler
- @old_gemfile_env = ENV["BUNDLE_GEMFILE"]
- ENV["BUNDLE_GEMFILE"] = app_path + "/Gemfile"
end
def teardown
teardown_app
-
- ENV["BUNDLE_GEMFILE"] = @old_gemfile_env
end
def test_bin_setup
@@ -47,6 +40,7 @@ def test_bin_setup_output
output = `bin/setup 2>&1`
assert_equal(<<-OUTPUT, output)
== Installing dependencies ==
+Resolving dependencies...
The Gemfile's dependencies are satisfied
== Preparing database ==
@@ -59,16 +53,5 @@ def test_bin_setup_output
OUTPUT
end
end
-
- private
- def create_gemfile
- app_file("Gemfile", "source 'https://rubygems.org'")
- app_file("Gemfile", "gem 'rails', path: '#{RAILS_FRAMEWORK_ROOT}'", "a")
- app_file("Gemfile", "gem 'sqlite3'", "a")
- end
-
- def update_boot_file_to_use_bundler
- app_file("config/boot.rb", "require 'bundler/setup'")
- end
end
end

0 comments on commit e646bad

Please sign in to comment.