1
0
Fork 0

Rename prefix to title

This commit is contained in:
Andrew Tomaka 2015-10-08 12:40:31 -04:00
parent e0c8c56dbd
commit 1655d48d21
5 changed files with 12 additions and 7 deletions

View file

@ -12,7 +12,7 @@ class Card < ActiveRecord::Base
delegate :name, to: :character, prefix: false delegate :name, to: :character, prefix: false
validates :prefix, presence: true validates :title, presence: true
validates :character, presence: true validates :character, presence: true
validates :gameid, presence: true, validates :gameid, presence: true,
numericality: { only_integer: true }, numericality: { only_integer: true },
@ -26,7 +26,7 @@ class Card < ActiveRecord::Base
end end
def full_name def full_name
"#{prefix} #{character.name}" "#{title} #{character.name}"
end end
def icon def icon

View file

@ -4,7 +4,7 @@
.col-md-4 .col-md-4
= f.input :gameid, label: 'Game ID Number' = f.input :gameid, label: 'Game ID Number'
.col-md-4 .col-md-4
= f.input :prefix = f.input :title
.col-md-4 .col-md-4
= f.association :character = f.association :character
.row .row

View file

@ -8,14 +8,14 @@
table.table.table-striped.table-hover table.table.table-striped.table-hover
thead thead
tr tr
th Prefix
th Name th Name
th Title
th Actions th Actions
tbody tbody
- @cards.each do |card| - @cards.each do |card|
tr tr
td= card.prefix
td= card.name td= card.name
td= card.title
td td
= link_to glyph('edit', classes: 'control-icon'), edit_card_path(card) = link_to glyph('edit', classes: 'control-icon'), edit_card_path(card)
= link_to glyph('trash', classes: 'control-icon'), card_path(card), method: :delete = link_to glyph('trash', classes: 'control-icon'), card_path(card), method: :delete

View file

@ -0,0 +1,5 @@
class RenameCardsPrefixToTitle < ActiveRecord::Migration
def change
rename_column :cards, :prefix, :title
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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| create_table "awaken_types", force: :cascade do |t|
t.string "name" t.string "name"
@ -27,7 +27,7 @@ ActiveRecord::Schema.define(version: 20151007201555) do
t.integer "passive_skill_id" t.integer "passive_skill_id"
t.integer "super_attack_id" t.integer "super_attack_id"
t.integer "dokkan_id" t.integer "dokkan_id"
t.string "prefix" t.string "title"
t.string "gameid", default: "0000000" t.string "gameid", default: "0000000"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false