提交 5f00ed10 编写于 作者: Y Yves Senn

Revert "Merge pull request #19755 from yuki24/activerecord/support-for-set"

This reverts commit 524d4059, reversing
changes made to 34d3a609.

Reasoning behind the revert are in the PR discussion:
https://github.com/rails/rails/pull/19755

- This means that types can no longer cast to/from `Set`, and reasonably
  work with `where` (we already have this problem for `array`/`json`
  types on pg)
- This adds precedent for every other `Enumerable`, and we can't target
  `Enumerable` directly.
- Calling `to_a` on a `Set` is reasonable.
上级 163de757
* Add support for `Set` to `Relation#where`.
*Yuki Nishijima*
* Fixed a bug where uniqueness validations would error on out of range values,
even if an validation should have prevented it from hitting the database.
......
......@@ -20,7 +20,6 @@ def initialize(table)
register_handler(Range, RangeHandler.new(self))
register_handler(Relation, RelationHandler.new)
register_handler(Array, ArrayHandler.new(self))
register_handler(Set, ArrayHandler.new(self))
register_handler(AssociationQueryValue, AssociationQueryHandler.new(self))
end
......
......@@ -848,16 +848,6 @@ def test_find_all_using_where_with_relation_with_select_to_build_subquery
}
end
def test_find_all_using_where_with_a_set
david = authors(:david)
mary = authors(:mary)
set = Set.new([david.id, mary.id])
assert_queries(1) {
assert_equal [david, mary], Author.where(id: set).to_a
}
end
def test_exists
davids = Author.where(:name => 'David')
assert davids.exists?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册