diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-16 15:19:06 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-16 15:23:57 +0900 |
commit | 189b8a06dc703f7a8477f877f0a02e23dd691ed8 (patch) | |
tree | d4c11a0c8abf9d695d30fb7de4ea7076840aa2f9 /activerecord/test/cases | |
parent | 1766e8e6ff9133b8254937791d48eedf2a3f7864 (diff) | |
download | rails-189b8a06dc703f7a8477f877f0a02e23dd691ed8.tar.gz rails-189b8a06dc703f7a8477f877f0a02e23dd691ed8.tar.bz2 rails-189b8a06dc703f7a8477f877f0a02e23dd691ed8.zip |
Use `where(id: 10)` rather than `where(relation.table[:id].eq(10))`
Because Arel is a private API and to describe `where_values_hash` keys
constructed by `where` are string.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relation_test.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 382aa17c34..9bc7c9f949 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -52,8 +52,8 @@ module ActiveRecord def test_has_values relation = Relation.new(Post, Post.arel_table, Post.predicate_builder) - relation.where! relation.table[:id].eq(10) - assert_equal({ id: 10 }, relation.where_values_hash) + relation.where!(id: 10) + assert_equal({ "id" => 10 }, relation.where_values_hash) end def test_values_wrong_table @@ -90,9 +90,9 @@ module ActiveRecord def test_create_with_value_with_wheres relation = Relation.new(Post, Post.arel_table, Post.predicate_builder) - relation.where! relation.table[:id].eq(10) + relation.where!(id: 10) relation.create_with_value = { hello: "world" } - assert_equal({ hello: "world", id: 10 }, relation.scope_for_create) + assert_equal({ hello: "world", "id" => 10 }, relation.scope_for_create) end # FIXME: is this really wanted or expected behavior? @@ -100,7 +100,7 @@ module ActiveRecord relation = Relation.new(Post, Post.arel_table, Post.predicate_builder) assert_equal({}, relation.scope_for_create) - relation.where! relation.table[:id].eq(10) + relation.where!(id: 10) assert_equal({}, relation.scope_for_create) relation.create_with_value = { hello: "world" } |