Skip to content

Commit 96dd8a6

Browse files
authored
Merge pull request #104 from plural/restriction-relationships
Fill in the restriction relationships for cards.
2 parents 4618bcb + d163489 commit 96dd8a6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/models/card.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ class Card < ApplicationRecord
1010
has_many :card_pool_cards
1111
has_many :card_pools, :through => :card_pool_cards
1212
has_many :restriction_card_banned
13-
has_many :restrictions, :through => :restriction_card_banned
14-
13+
has_many :restriction_card_global_penalty
14+
has_many :restriction_card_points, class_name: 'RestrictionCardPoints'
15+
has_many :restriction_card_restricted
16+
has_many :restriction_card_universal_faction_cost
17+
# This is here to support restrictions, but isn't usable on it's own.
1518
has_many :unified_restrictions
19+
# Will be all restrictions that directly reference this card in any way.
20+
has_many :restrictions, -> { where('unified_restrictions.in_restriction': true) }, :through => :unified_restrictions
1621

1722
validates :name, uniqueness: true
1823

0 commit comments

Comments
 (0)