Add dokkan card
This commit is contained in:
parent
9ff9131d52
commit
e0c8c56dbd
3 changed files with 14 additions and 3 deletions
|
@ -45,7 +45,7 @@ class CardsController < ApplicationController
|
|||
params.require(:card).permit(:prefix, :character_id, :rarity_id, :type_id,
|
||||
:leader_skill_id, :passive_skill_id,
|
||||
:super_attack_id, :dokkan_id, :gameid,
|
||||
:awaken_type_id, link_ids: [])
|
||||
:awaken_type_id, :dokkan_id, link_ids: [])
|
||||
end
|
||||
|
||||
def set_card
|
||||
|
|
|
@ -6,7 +6,7 @@ class Card < ActiveRecord::Base
|
|||
belongs_to :passive_skill
|
||||
belongs_to :super_attack
|
||||
belongs_to :awaken_type
|
||||
has_one :dokkan_card, class_name: 'Card', foreign_key: :dokkan_id
|
||||
belongs_to :dokkan_card, class_name: 'Card', foreign_key: :dokkan_id
|
||||
|
||||
has_and_belongs_to_many :links
|
||||
|
||||
|
@ -22,6 +22,14 @@ class Card < ActiveRecord::Base
|
|||
validates :awaken_type, presence: true
|
||||
|
||||
def dokkan?
|
||||
self.dokkan_id != nil
|
||||
dokkan_id != nil
|
||||
end
|
||||
|
||||
def full_name
|
||||
"#{prefix} #{character.name}"
|
||||
end
|
||||
|
||||
def icon
|
||||
"card_#{gameid}_thumb.png"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
.row
|
||||
.col-md-6
|
||||
= f.association :super_attack
|
||||
.row
|
||||
.col-md-6
|
||||
= f.association :dokkan_card, label_method: :full_name
|
||||
.row
|
||||
.col-md-12
|
||||
= f.label :links
|
||||
|
|
Loading…
Reference in a new issue