diff --git a/lib/redmine_git_hosting/cache/database.rb b/lib/redmine_git_hosting/cache/database.rb index 4dda704f7..db7430847 100644 --- a/lib/redmine_git_hosting/cache/database.rb +++ b/lib/redmine_git_hosting/cache/database.rb @@ -47,7 +47,7 @@ def clear_cache_for_repository(repo_id) end def apply_cache_limit - GitCache.find(:last, order: 'created_at DESC').destroy if max_cache_elements >= 0 && GitCache.count > max_cache_elements + GitCache.order(:created_at).first.destroy if max_cache_elements >= 0 && GitCache.count > max_cache_elements end end end