aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-03 23:22:47 -0500
committerGitHub <noreply@github.com>2017-01-03 23:22:47 -0500
commita2b4df5b0bc2c1494665e07104cd2d8ceee08878 (patch)
treeb1bfaba39ee039e5757d5843746007eec7819027 /activerecord/test/cases
parentb9db45bb632853b709c64c736859e9ee347ca4bf (diff)
parentb334aa0ea4008221c475adc5b124f3b23b785aba (diff)
downloadrails-a2b4df5b0bc2c1494665e07104cd2d8ceee08878.tar.gz
rails-a2b4df5b0bc2c1494665e07104cd2d8ceee08878.tar.bz2
rails-a2b4df5b0bc2c1494665e07104cd2d8ceee08878.zip
Merge pull request #27564 from kamipo/fix_find_by_active_record_base_object-2
Fix `find_by` and `where` consistency
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/finder_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 97010b1fd9..e0ad9f5ec1 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -339,6 +339,11 @@ class FinderTest < ActiveRecord::TestCase
assert_equal author.post, Post.find_by(author_id: Author.where(id: author))
end
+ def test_find_by_and_where_consistency_with_active_record_instance
+ author = authors(:david)
+ assert_equal Post.where(author_id: author).take, Post.find_by(author_id: author)
+ end
+
def test_take
assert_equal topics(:first), Topic.take
end