hensei-api/app/models/party.rb

14 lines
No EOL
555 B
Ruby

class Party < ApplicationRecord
##### ActiveRecord Associations
belongs_to :user, optional: true
belongs_to :raid, optional: true
belongs_to :favorite, optional: true
has_many :characters, foreign_key: "party_id", class_name: "GridCharacter", dependent: :destroy
has_many :weapons, foreign_key: "party_id", class_name: "GridWeapon", dependent: :destroy
has_many :summons, foreign_key: "party_id", class_name: "GridSummon", dependent: :destroy
def is_favorited(user)
user.favorite_parties.include? self
end
end