From 1655d48d2103b2795bf3b8eb142f62af0d99812a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 8 Oct 2015 12:40:31 -0400 Subject: [PATCH] Rename prefix to title --- app/models/card.rb | 4 ++-- app/views/cards/_form.html.slim | 2 +- app/views/cards/index.html.slim | 4 ++-- db/migrate/20151008163922_rename_cards_prefix_to_title.rb | 5 +++++ db/schema.rb | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20151008163922_rename_cards_prefix_to_title.rb diff --git a/app/models/card.rb b/app/models/card.rb index fcb87d8..f062a49 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -12,7 +12,7 @@ class Card < ActiveRecord::Base delegate :name, to: :character, prefix: false - validates :prefix, presence: true + validates :title, presence: true validates :character, presence: true validates :gameid, presence: true, numericality: { only_integer: true }, @@ -26,7 +26,7 @@ class Card < ActiveRecord::Base end def full_name - "#{prefix} #{character.name}" + "#{title} #{character.name}" end def icon diff --git a/app/views/cards/_form.html.slim b/app/views/cards/_form.html.slim index e30cee1..0474b52 100644 --- a/app/views/cards/_form.html.slim +++ b/app/views/cards/_form.html.slim @@ -4,7 +4,7 @@ .col-md-4 = f.input :gameid, label: 'Game ID Number' .col-md-4 - = f.input :prefix + = f.input :title .col-md-4 = f.association :character .row diff --git a/app/views/cards/index.html.slim b/app/views/cards/index.html.slim index 7953510..f5f85a4 100644 --- a/app/views/cards/index.html.slim +++ b/app/views/cards/index.html.slim @@ -8,14 +8,14 @@ table.table.table-striped.table-hover thead tr - th Prefix th Name + th Title th Actions tbody - @cards.each do |card| tr - td= card.prefix td= card.name + td= card.title td = link_to glyph('edit', classes: 'control-icon'), edit_card_path(card) = link_to glyph('trash', classes: 'control-icon'), card_path(card), method: :delete diff --git a/db/migrate/20151008163922_rename_cards_prefix_to_title.rb b/db/migrate/20151008163922_rename_cards_prefix_to_title.rb new file mode 100644 index 0000000..15cd3aa --- /dev/null +++ b/db/migrate/20151008163922_rename_cards_prefix_to_title.rb @@ -0,0 +1,5 @@ +class RenameCardsPrefixToTitle < ActiveRecord::Migration + def change + rename_column :cards, :prefix, :title + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a73c36..6b89bd5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151007201555) do +ActiveRecord::Schema.define(version: 20151008163922) do create_table "awaken_types", force: :cascade do |t| t.string "name" @@ -27,7 +27,7 @@ ActiveRecord::Schema.define(version: 20151007201555) do t.integer "passive_skill_id" t.integer "super_attack_id" t.integer "dokkan_id" - t.string "prefix" + t.string "title" t.string "gameid", default: "0000000" t.datetime "created_at", null: false t.datetime "updated_at", null: false