From b92770aeb49898be06a765ec6164b57ef33980c9 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 17 Mar 2015 22:32:39 -0500 Subject: [PATCH] Rename User.userid to User.char_id. --- app/models/user.rb | 4 ++-- db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb | 5 +++++ db/schema.rb | 4 ++-- lib/tasks/calefaction.rake | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 682acc8..a0171a3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,12 +10,12 @@ class User < ActiveRecord::Base end def name - sheet = api.character_sheet(userid) + sheet = api.character_sheet(char_id) sheet.nil? ? '?' : sheet.name end def corp_id - sheet = api.character_sheet(userid) + sheet = api.character_sheet(char_id) sheet.nil? ? 0 : sheet.corporationID.to_i end diff --git a/db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb b/db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb new file mode 100644 index 0000000..1382f25 --- /dev/null +++ b/db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb @@ -0,0 +1,5 @@ +class RenameUseridToCharIdInUser < ActiveRecord::Migration + def change + rename_column :users, :userid, :char_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 10b8969..b460471 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: 20150317052416) do +ActiveRecord::Schema.define(version: 20150318032955) do create_table "admin_settings", force: :cascade do |t| t.string "key" @@ -19,7 +19,7 @@ ActiveRecord::Schema.define(version: 20150317052416) do end create_table "users", force: :cascade do |t| - t.integer "userid" + t.integer "char_id" t.string "email" t.string "password_digest" t.string "api_key" diff --git a/lib/tasks/calefaction.rake b/lib/tasks/calefaction.rake index 4391e48..bfbfedc 100644 --- a/lib/tasks/calefaction.rake +++ b/lib/tasks/calefaction.rake @@ -52,7 +52,7 @@ namespace :calefaction do if chars.length == 1 puts "\nUsing character: #{chars.first.name}" - user.userid = chars.first.characterID + user.char_id = chars.first.characterID else puts "\nChoose a character:" chars.each_with_index do |char, i| @@ -62,7 +62,7 @@ namespace :calefaction do loop do index = STDIN.gets.to_i if index >= 0 && index < chars.length - user.userid = chars[index].characterID and break + user.char_id = chars[index].characterID and break end print "Bad input; try again: " end