diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-12 23:28:31 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-12 23:28:31 +0100 |
commit | 2286fa94716b138a7763e95ade87a7582864bb42 (patch) | |
tree | 2add62f200f3aac7b25a9e829485cab829088c93 /actionview | |
parent | 40599d1d7468e8d13932ada859987d9d2f32cb18 (diff) | |
download | rails-2286fa94716b138a7763e95ade87a7582864bb42.tar.gz rails-2286fa94716b138a7763e95ade87a7582864bb42.tar.bz2 rails-2286fa94716b138a7763e95ade87a7582864bb42.zip |
Prefer empty? to any?.
If the collection isn't empty any? will loop through it.
Spare the loop and be more concise with what we're asking the
collection about.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb index e6d57b802e..4860f00243 100644 --- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb @@ -18,7 +18,7 @@ module ActionView cached_partials = collection_cache.read_multi(*keyed_collection.keys) @collection = keyed_collection.reject { |key, _| cached_partials.key?(key) }.values - rendered_partials = @collection.any? ? yield : [] + rendered_partials = @collection.empty? ? [] : yield index = 0 keyed_collection.map do |cache_key, _| |