1
0
Fork 0

Add dokkan card

This commit is contained in:
Andrew Tomaka 2015-10-08 11:45:05 -04:00
parent 9ff9131d52
commit e0c8c56dbd
3 changed files with 14 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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