diff options
author | Lann Martin <lann@causes.com> | 2013-09-04 16:47:28 -0700 |
---|---|---|
committer | Lann Martin <lann@lannbox.com> | 2013-09-09 15:17:44 -0600 |
commit | 8875e28a50b117aa862c8563c49f7e3a6ee7deff (patch) | |
tree | fe508015d39bc6ca217976ab3d814a6517f2c926 /activerecord/test/cases/json_serialization_test.rb | |
parent | c27fde26166f71ec68a7fb501435b656f436a687 (diff) | |
download | rails-8875e28a50b117aa862c8563c49f7e3a6ee7deff.tar.gz rails-8875e28a50b117aa862c8563c49f7e3a6ee7deff.tar.bz2 rails-8875e28a50b117aa862c8563c49f7e3a6ee7deff.zip |
Make CollectionAssociation first/last with integer fetch with query
When first or last is called with an integer on an unloaded association,
the entire collection is loaded. This differs surprisingly from the
behavior of Relation#first/last, which translate the call into a limit
query. For large collections this can make a big difference in
performance.
Change CollectionAssociation#fetch_first_or_last_using_find? to make
this kind of call delegate to Relation.
Diffstat (limited to 'activerecord/test/cases/json_serialization_test.rb')
0 files changed, 0 insertions, 0 deletions