diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-01-24 13:04:36 -0500 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-01-24 13:04:36 -0500 |
commit | 6b89c4a24749ed972930ad1e27308bcda48c362b (patch) | |
tree | 56ad41d7bcb562ed722d1a2d0fc7d0e959d94aba /activerecord/test/cases/collection_cache_key_test.rb | |
parent | 9e6969412bc97494298930143c7e6e6b1434827b (diff) | |
parent | 29cf0dd9f48782c94de924a11b4fd1ad7b939dc5 (diff) | |
download | rails-6b89c4a24749ed972930ad1e27308bcda48c362b.tar.gz rails-6b89c4a24749ed972930ad1e27308bcda48c362b.tar.bz2 rails-6b89c4a24749ed972930ad1e27308bcda48c362b.zip |
Merge pull request #23051 from prathamesh-sonpatki/fix-collection-cache-key
Fix AR::Relation#cache_key to remove select scope added by user
Diffstat (limited to 'activerecord/test/cases/collection_cache_key_test.rb')
-rw-r--r-- | activerecord/test/cases/collection_cache_key_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/collection_cache_key_test.rb b/activerecord/test/cases/collection_cache_key_test.rb index 6b34979e4a..a2874438c1 100644 --- a/activerecord/test/cases/collection_cache_key_test.rb +++ b/activerecord/test/cases/collection_cache_key_test.rb @@ -79,5 +79,11 @@ module ActiveRecord developers = Developer.offset(20) assert_match(/\Adevelopers\/query-(\h+)-0\Z/, developers.cache_key) end + + test "cache_key with a relation having selected columns" do + developers = Developer.select(:salary) + + assert_match(/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\Z/, developers.cache_key) + end end end |