Commit a861b36d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor Package.last_of_each_version method

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent e79123fe
...@@ -34,11 +34,6 @@ class Packages::Package < ActiveRecord::Base ...@@ -34,11 +34,6 @@ class Packages::Package < ActiveRecord::Base
end end
def self.last_of_each_version def self.last_of_each_version
ids = self where(id: all.select('MAX(id) AS id').group(:version))
.select('MAX(id) AS id')
.group(:version)
.map(&:id)
where(id: ids)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment