Skip to content

Commit ae28170

Browse files
committed
Fix compats method for both gemmy and lockfile
1 parent 5e3ddd0 commit ae28170

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

app/models/concerns/has_compats.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/models/gemmy.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
class Gemmy < ApplicationRecord
2-
include HasCompats
3-
42
FORBIDDEN_NAMES = %w(
53
new
64
edit
@@ -11,6 +9,10 @@ class Gemmy < ApplicationRecord
119

1210
delegate :to_param, :to_s, to: :name
1311

12+
def compats
13+
Compat.where(id: compat_ids)
14+
end
15+
1416
def dependencies
1517
dependencies_and_versions
1618
.keys

app/models/lockfile.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
class Lockfile < ApplicationRecord
2-
include HasCompats
3-
42
has_many :dependencies, class_name: "LockfileDependency", dependent: :destroy
53
has_many :gemmies, through: :dependencies
64

@@ -11,6 +9,10 @@ class Lockfile < ApplicationRecord
119
delegate :to_param, to: :slug
1210

1311
scope :with_gemmies, ->(gemmies) { joins(:gemmies).where(gemmies: { id: gemmies }).distinct }
12+
13+
def compats
14+
Compat.where(id: gemmies.flat_map(&:compat_ids))
15+
end
1416
end
1517

1618
# == Schema Information

0 commit comments

Comments
 (0)