Browse Source

Rename User.userid to User.char_id.

old-ruby
Ben Kurtovic 9 years ago
parent
commit
b92770aeb4
4 changed files with 11 additions and 6 deletions
  1. +2
    -2
      app/models/user.rb
  2. +5
    -0
      db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb
  3. +2
    -2
      db/schema.rb
  4. +2
    -2
      lib/tasks/calefaction.rake

+ 2
- 2
app/models/user.rb View File

@@ -10,12 +10,12 @@ class User < ActiveRecord::Base
end end


def name def name
sheet = api.character_sheet(userid)
sheet = api.character_sheet(char_id)
sheet.nil? ? '?' : sheet.name sheet.nil? ? '?' : sheet.name
end end


def corp_id def corp_id
sheet = api.character_sheet(userid)
sheet = api.character_sheet(char_id)
sheet.nil? ? 0 : sheet.corporationID.to_i sheet.nil? ? 0 : sheet.corporationID.to_i
end end




+ 5
- 0
db/migrate/20150318032955_rename_userid_to_char_id_in_user.rb View File

@@ -0,0 +1,5 @@
class RenameUseridToCharIdInUser < ActiveRecord::Migration
def change
rename_column :users, :userid, :char_id
end
end

+ 2
- 2
db/schema.rb 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: 20150317052416) do
ActiveRecord::Schema.define(version: 20150318032955) do


create_table "admin_settings", force: :cascade do |t| create_table "admin_settings", force: :cascade do |t|
t.string "key" t.string "key"
@@ -19,7 +19,7 @@ ActiveRecord::Schema.define(version: 20150317052416) do
end end


create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.integer "userid"
t.integer "char_id"
t.string "email" t.string "email"
t.string "password_digest" t.string "password_digest"
t.string "api_key" t.string "api_key"


+ 2
- 2
lib/tasks/calefaction.rake View File

@@ -52,7 +52,7 @@ namespace :calefaction do


if chars.length == 1 if chars.length == 1
puts "\nUsing character: #{chars.first.name}" puts "\nUsing character: #{chars.first.name}"
user.userid = chars.first.characterID
user.char_id = chars.first.characterID
else else
puts "\nChoose a character:" puts "\nChoose a character:"
chars.each_with_index do |char, i| chars.each_with_index do |char, i|
@@ -62,7 +62,7 @@ namespace :calefaction do
loop do loop do
index = STDIN.gets.to_i index = STDIN.gets.to_i
if index >= 0 && index < chars.length if index >= 0 && index < chars.length
user.userid = chars[index].characterID and break
user.char_id = chars[index].characterID and break
end end
print "Bad input; try again: " print "Bad input; try again: "
end end


Loading…
Cancel
Save