diff --git a/app/controllers/cards_controller.rb b/app/controllers/cards_controller.rb index 75dcd5b..05dc916 100644 --- a/app/controllers/cards_controller.rb +++ b/app/controllers/cards_controller.rb @@ -2,7 +2,7 @@ class CardsController < ApplicationController before_action :set_card, only: [:show, :edit, :update, :destroy] def index - @cards = Card.all + @cards = Card.includes(:character).all end def show @@ -42,7 +42,7 @@ class CardsController < ApplicationController private def card_params - params.require(:card).permit(:prefix, :character_id, :rarity_id, :type_id, + params.require(:card).permit(:title, :character_id, :rarity_id, :type_id, :leader_skill_id, :passive_skill_id, :super_attack_id, :dokkan_id, :gameid, :awaken_type_id, :dokkan_id, link_ids: []) diff --git a/app/models/super_attack.rb b/app/models/super_attack.rb index 7e2db48..20a802a 100644 --- a/app/models/super_attack.rb +++ b/app/models/super_attack.rb @@ -1,4 +1,8 @@ class SuperAttack < ActiveRecord::Base validates :name, presence: true validates :description, presence: true + + def full + "#{name} - #{description}" + end end diff --git a/app/views/cards/_form.html.slim b/app/views/cards/_form.html.slim index 0474b52..c0f4e3d 100644 --- a/app/views/cards/_form.html.slim +++ b/app/views/cards/_form.html.slim @@ -21,10 +21,10 @@ = f.association :passive_skill .row .col-md-6 - = f.association :super_attack + = f.association :super_attack, label_method: :full .row .col-md-6 - = f.association :dokkan_card, label_method: :full_name + = f.association :dokkan_card, collection: Card.includes(:character).all, label_method: :full_name .row .col-md-12 = f.label :links