質問するログイン新規登録

質問編集履歴

2

加筆

2021/10/08 05:18

投稿

bardy
bardy

スコア3

title CHANGED
File without changes
body CHANGED
@@ -35,4 +35,86 @@
35
35
  end
36
36
  end
37
37
 
38
+ ```
39
+
40
+ ```ここに言語を入力
41
+ #api/db/migrate/20211006114511_devise_token_auth_create_users.rb
42
+
43
+ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.2]
44
+ def change
45
+
46
+ change_table(:users) do |t|
47
+ ## Required
48
+ t.string :provider, :null => false, :default => "email"
49
+ t.string :uid, :null => false, :default => ""
50
+
51
+ ## Database authenticatable
52
+ t.string :encrypted_password, :null => false, :default => ""
53
+
54
+ ## Recoverable
55
+ t.string :reset_password_token
56
+ t.datetime :reset_password_sent_at
57
+ t.boolean :allow_password_change, :default => false
58
+
59
+ ## Rememberable
60
+ t.datetime :remember_created_at
61
+
62
+ # 追記 --------------------------------------------
63
+ ## Trackable
64
+ t.integer :sign_in_count, default: 0, null: false
65
+ t.datetime :current_sign_in_at
66
+ t.datetime :last_sign_in_at
67
+ t.string :current_sign_in_ip
68
+ t.string :last_sign_in_ip
69
+ # -----------------------------------------------------
70
+
71
+ ## Confirmable
72
+ t.string :confirmation_token
73
+ t.datetime :confirmed_at
74
+ t.datetime :confirmation_sent_at
75
+ t.string :unconfirmed_email # Only if using reconfirmable
76
+
77
+ ## Lockable
78
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
79
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
80
+ # t.datetime :locked_at
81
+
82
+ ## User Info
83
+ # t.string :name
84
+ # t.string :nickname
85
+ t.string :image
86
+ # t.string :email
87
+
88
+ ## Tokens
89
+ t.text :tokens
90
+
91
+ t.timestamps
92
+ end
93
+
94
+ add_index :users, :email, unique: true
95
+ add_index :users, [:uid, :provider], unique: true
96
+ add_index :users, :reset_password_token, unique: true
97
+ add_index :users, :confirmation_token, unique: true
98
+ # add_index :users, :unlock_token, unique: true
99
+ end
100
+ end
101
+
102
+ ```
103
+
104
+ ```ここに言語を入力
105
+ #api/db/migrate/20211007175252_create_users.rb
106
+
107
+ class CreateUsers < ActiveRecord::Migration[5.2]
108
+ def change
109
+ create_table :users do |t|
110
+ t.string :name
111
+ t.string :user_id
112
+ t.string :email
113
+ t.string :password
114
+
115
+ t.timestamps
116
+ end
117
+ end
118
+ end
119
+
38
120
  ```

1

加筆

2021/10/08 05:18

投稿

bardy
bardy

スコア3

title CHANGED
File without changes
body CHANGED
@@ -7,9 +7,8 @@
7
7
 
8
8
  調べたところ、ファイル名とクラス名が一致していないのが原因のようですが、クラス名というのはコントローラーのことなんでしょうか。
9
9
 
10
- 解決できる方おられますでしょうか。
10
+ 初学者なので、初歩的な質問かもしれないですが、解決できる方おられますでしょうか。
11
- 他にソースコードが必要であれば言って下さい
11
+ 他にソースコードが必要であれば追加致します
12
- よろしくお願い致します。
13
12
 
14
13
  ```
15
14
  #users_controller.rb