diff --git a/app/controllers/api/v1/release_engines/npm/package_metadata_controller.rb b/app/controllers/api/v1/release_engines/npm/package_metadata_controller.rb index 6e939c180..537ffd80b 100644 --- a/app/controllers/api/v1/release_engines/npm/package_metadata_controller.rb +++ b/app/controllers/api/v1/release_engines/npm/package_metadata_controller.rb @@ -20,7 +20,7 @@ def show to: :index? # FIXME(ezekg) https://github.com/brianhempel/active_record_union/issues/35 - last_modified = artifacts.maximum(:"#{artifacts.table_name}.updated_at") + last_modified = artifacts.collect(&:updated_at).max latest = artifacts.first metadata = artifacts.reduce( name: package.key, diff --git a/app/controllers/api/v1/release_engines/pypi/simple_controller.rb b/app/controllers/api/v1/release_engines/pypi/simple_controller.rb index a701b5720..6fd462f8d 100644 --- a/app/controllers/api/v1/release_engines/pypi/simple_controller.rb +++ b/app/controllers/api/v1/release_engines/pypi/simple_controller.rb @@ -33,7 +33,7 @@ def show to: :index? # FIXME(ezekg) https://github.com/brianhempel/active_record_union/issues/35 - last_modified = artifacts.maximum(:"#{artifacts.table_name}.updated_at") + last_modified = artifacts.collect(&:updated_at).max return unless stale?(artifacts, last_modified:, cache_control: { max_age: 1.day, private: true })