diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-29 12:59:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 12:59:47 -0400 |
commit | eccc149be362ccf12446ed1c8287e011731a817b (patch) | |
tree | 5b25e44a6239f118c8df5aab99021c43659e6115 /activerecord/test/cases | |
parent | 098e94caf6515c92334b03af4c8358e39a4201a5 (diff) | |
parent | 3d6176fded424a2195e399d031e343bbcd0edcad (diff) | |
download | rails-eccc149be362ccf12446ed1c8287e011731a817b.tar.gz rails-eccc149be362ccf12446ed1c8287e011731a817b.tar.bz2 rails-eccc149be362ccf12446ed1c8287e011731a817b.zip |
Merge pull request #28592 from htanata/ar_relation_inspect_should_not_load_all_records
Load only needed records on ActiveRecord::Relation#inspect
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 8c06b1537a..856469c710 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1901,6 +1901,12 @@ class RelationTest < ActiveRecord::TestCase assert_equal "#<ActiveRecord::Relation [#{Post.limit(10).map(&:inspect).join(', ')}, ...]>", relation.inspect end + test "relations don't load all records in #inspect" do + assert_sql(/LIMIT/) do + Post.all.inspect + end + end + test "already-loaded relations don't perform a new query in #inspect" do relation = Post.limit(2) relation.to_a |