aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-07-02 19:03:32 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-07-02 19:03:32 -0700
commit970c311432d66fec4c07ee93a78e6f2101b8fd6d (patch)
tree8513c9063ebec9c86e8d314b30b15b073588a99d /activerecord
parentbf12c35087b1112b37340274104ff1ec62b3c118 (diff)
parent341b73965d796ab4f04a4053735409ae34dfcf6c (diff)
downloadrails-970c311432d66fec4c07ee93a78e6f2101b8fd6d.tar.gz
rails-970c311432d66fec4c07ee93a78e6f2101b8fd6d.tar.bz2
rails-970c311432d66fec4c07ee93a78e6f2101b8fd6d.zip
Merge pull request #11258 from frodsan/remove_deprecated_distinct
Remove deprecated SchemaStatements#distinct
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md4
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb9
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb46
3 files changed, 4 insertions, 55 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index c0eae23c84..cf65f6dcd3 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated `SchemaStatements#distinct`.
+
+ *Francesco Rodriguez*
+
* Move deprecated `ActiveRecord::TestCase` into the rails test
suite. The class is no longer public and is only used for internal
Rails tests.
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 9a1923dec5..d93b79d57f 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -694,15 +694,6 @@ module ActiveRecord
end
end
- # SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause.
- #
- # distinct("posts.id", ["posts.created_at desc"])
- #
- def distinct(columns, order_by)
- ActiveSupport::Deprecation.warn("#distinct is deprecated and shall be removed from future releases.")
- "DISTINCT #{columns_for_distinct(columns, order_by)}"
- end
-
# Given a set of columns and an ORDER BY clause, returns the columns for a SELECT DISTINCT.
# Both PostgreSQL and Oracle overrides this for custom DISTINCT syntax - they
# require the order columns appear in the SELECT.
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
index fb88ab7c09..8b017760b1 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -225,65 +225,26 @@ module ActiveRecord
assert_equal "(number > 100)", index.where
end
- def test_distinct_zero_orders
- assert_deprecated do
- assert_equal "DISTINCT posts.id",
- @connection.distinct("posts.id", [])
- end
- end
-
def test_columns_for_distinct_zero_orders
assert_equal "posts.id",
@connection.columns_for_distinct("posts.id", [])
end
- def test_distinct_one_order
- assert_deprecated do
- assert_equal "DISTINCT posts.id, posts.created_at AS alias_0",
- @connection.distinct("posts.id", ["posts.created_at desc"])
- end
- end
-
def test_columns_for_distinct_one_order
assert_equal "posts.id, posts.created_at AS alias_0",
@connection.columns_for_distinct("posts.id", ["posts.created_at desc"])
end
- def test_distinct_few_orders
- assert_deprecated do
- assert_equal "DISTINCT posts.id, posts.created_at AS alias_0, posts.position AS alias_1",
- @connection.distinct("posts.id", ["posts.created_at desc", "posts.position asc"])
- end
- end
-
def test_columns_for_distinct_few_orders
assert_equal "posts.id, posts.created_at AS alias_0, posts.position AS alias_1",
@connection.columns_for_distinct("posts.id", ["posts.created_at desc", "posts.position asc"])
end
- def test_distinct_blank_not_nil_orders
- assert_deprecated do
- assert_equal "DISTINCT posts.id, posts.created_at AS alias_0",
- @connection.distinct("posts.id", ["posts.created_at desc", "", " "])
- end
- end
-
def test_columns_for_distinct_blank_not_nil_orders
assert_equal "posts.id, posts.created_at AS alias_0",
@connection.columns_for_distinct("posts.id", ["posts.created_at desc", "", " "])
end
- def test_distinct_with_arel_order
- order = Object.new
- def order.to_sql
- "posts.created_at desc"
- end
- assert_deprecated do
- assert_equal "DISTINCT posts.id, posts.created_at AS alias_0",
- @connection.distinct("posts.id", [order])
- end
- end
-
def test_columns_for_distinct_with_arel_order
order = Object.new
def order.to_sql
@@ -293,13 +254,6 @@ module ActiveRecord
@connection.columns_for_distinct("posts.id", [order])
end
- def test_distinct_with_nulls
- assert_deprecated do
- assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls first"])
- assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls last"])
- end
- end
-
def test_columns_for_distinct_with_nulls
assert_equal "posts.title, posts.updater_id AS alias_0", @connection.columns_for_distinct("posts.title", ["posts.updater_id desc nulls first"])
assert_equal "posts.title, posts.updater_id AS alias_0", @connection.columns_for_distinct("posts.title", ["posts.updater_id desc nulls last"])