From b9e5ace491b02fc31c51927e40bca5c26857422e Mon Sep 17 00:00:00 2001 From: Subarunari Date: Mon, 25 Dec 2017 21:43:08 +0900 Subject: [PATCH] #73 add icon column to user model --- app/models/user.rb | 1 + db/migrate/20171224150315_add_icon_to_users.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171224150315_add_icon_to_users.rb diff --git a/app/models/user.rb b/app/models/user.rb index 1931215..f333d4e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,6 +13,7 @@ class User < ApplicationRecord # relations has_many :games, dependent: :destroy + mount_uploader :icon, IconUploader def self.new_token SecureRandom.urlsafe_base64 diff --git a/db/migrate/20171224150315_add_icon_to_users.rb b/db/migrate/20171224150315_add_icon_to_users.rb new file mode 100644 index 0000000..5aa674f --- /dev/null +++ b/db/migrate/20171224150315_add_icon_to_users.rb @@ -0,0 +1,5 @@ +class AddIconToUsers < ActiveRecord::Migration[5.1] + def change + add_column :users, :icon, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 1614a15..e5672b2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171214162123) do +ActiveRecord::Schema.define(version: 20171224150315) do create_table "categories", force: :cascade do |t| t.string "name" @@ -80,6 +80,7 @@ t.datetime "updated_at", null: false t.string "username", default: "", null: false t.boolean "admin", default: false, null: false + t.string "icon" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true