質問編集履歴
4
user.rbの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -220,7 +220,9 @@
|
|
220
220
|
|
221
221
|
has_secure_password
|
222
222
|
|
223
|
+
devise :database_authenticatable, :registerable,
|
224
|
+
|
223
|
-
|
225
|
+
:recoverable, :rememberable, :validatable
|
224
226
|
|
225
227
|
validates :email, uniqueness: true
|
226
228
|
|
@@ -228,7 +230,7 @@
|
|
228
230
|
|
229
231
|
```
|
230
232
|
|
231
|
-
### 試したこと
|
233
|
+
### 試したこと1
|
232
234
|
|
233
235
|
user.rbの中の「has_secure_password」を削除したところ「ActiveModel::UnknownAttributeError in Users::RegistrationsController#create unknown attribute 'password' for User.」というエラーが発生したため、元に戻しました。
|
234
236
|
|
@@ -236,4 +238,22 @@
|
|
236
238
|
|
237
239
|
|
238
240
|
|
241
|
+
### 試したこと2
|
242
|
+
|
243
|
+
user.rbの「devise :rememberable」を
|
244
|
+
|
245
|
+
```
|
246
|
+
|
247
|
+
devise :database_authenticatable, :registerable,
|
248
|
+
|
249
|
+
:recoverable, :rememberable, :validatable
|
250
|
+
|
251
|
+
```
|
252
|
+
|
253
|
+
に変更しました。
|
254
|
+
|
255
|
+
すると今度は「ArgumentError in Users::RegistrationsController#create wrong number of arguments (given 0, expected 1)」というエラーが発生してしまいます。
|
256
|
+
|
257
|
+
|
258
|
+
|
239
259
|
失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。
|
3
試したことの繁栄
test
CHANGED
File without changes
|
test
CHANGED
@@ -228,6 +228,12 @@
|
|
228
228
|
|
229
229
|
```
|
230
230
|
|
231
|
+
### 試したこと
|
232
|
+
|
233
|
+
user.rbの中の「has_secure_password」を削除したところ「ActiveModel::UnknownAttributeError in Users::RegistrationsController#create unknown attribute 'password' for User.」というエラーが発生したため、元に戻しました。
|
234
|
+
|
235
|
+
![](fb370c4695682a91f001228c81c42f90.png)
|
236
|
+
|
231
237
|
|
232
238
|
|
233
239
|
失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。
|
2
user.rbの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -208,4 +208,26 @@
|
|
208
208
|
|
209
209
|
|
210
210
|
|
211
|
+
|
212
|
+
|
213
|
+
### 追記
|
214
|
+
|
215
|
+
app/models/user.rb
|
216
|
+
|
217
|
+
```
|
218
|
+
|
219
|
+
class User < ApplicationRecord
|
220
|
+
|
221
|
+
has_secure_password
|
222
|
+
|
223
|
+
devise :rememberable
|
224
|
+
|
225
|
+
validates :email, uniqueness: true
|
226
|
+
|
227
|
+
end
|
228
|
+
|
229
|
+
```
|
230
|
+
|
231
|
+
|
232
|
+
|
211
233
|
失礼な点があるかもしれませんがどうぞ宜しくおねがい致します。
|
1
schema.rbの繁栄
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
```
|
18
18
|
|
19
|
-
NoMethodError in Users::RegistrationsController#
|
19
|
+
NoMethodError in Users::RegistrationsController#create
|
20
20
|
|
21
21
|
undefined method `password_digest=' for #<User id: nil, email: nil, created_at: nil, updated_at: nil> Did you mean? password=
|
22
22
|
|
@@ -32,13 +32,13 @@
|
|
32
32
|
|
33
33
|
class Users::RegistrationsController < Devise::RegistrationsController
|
34
34
|
|
35
|
-
def
|
35
|
+
def new
|
36
36
|
|
37
37
|
@user = User.new
|
38
38
|
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def create
|
42
42
|
|
43
43
|
@user = User.new(email: params[:email], password: params[:password])
|
44
44
|
|
@@ -58,15 +58,11 @@
|
|
58
58
|
|
59
59
|
end
|
60
60
|
|
61
|
-
def create
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
61
|
end
|
66
62
|
|
67
63
|
```
|
68
64
|
|
69
|
-
app/views/devise/
|
65
|
+
app/views/devise/new.html.erb
|
70
66
|
|
71
67
|
```
|
72
68
|
|
@@ -74,7 +70,7 @@
|
|
74
70
|
|
75
71
|
<% @user = User.new unless @user %>
|
76
72
|
|
77
|
-
<%= form_for :@user,:url => {controller: "registrations", action: "
|
73
|
+
<%= form_for :@user,:url => {controller: "registrations", action: "create" } do |f| %>
|
78
74
|
|
79
75
|
<%= f.email_field :email %>
|
80
76
|
|
@@ -94,7 +90,107 @@
|
|
94
90
|
|
95
91
|
```
|
96
92
|
|
97
|
-
|
93
|
+
db/schema.rb
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
# This file is auto-generated from the current state of the database. Instead
|
98
|
+
|
99
|
+
# of editing this file, please use the migrations feature of Active Record to
|
100
|
+
|
101
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
102
|
+
|
103
|
+
#
|
104
|
+
|
105
|
+
# This file is the source Rails uses to define your schema when running `rails
|
106
|
+
|
107
|
+
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
|
108
|
+
|
109
|
+
# be faster and is potentially less error prone than running all of your
|
110
|
+
|
111
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
112
|
+
|
113
|
+
# migrations use external dependencies or application code.
|
114
|
+
|
115
|
+
#
|
116
|
+
|
117
|
+
# It's strongly recommended that you check this file into your version control system.
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
ActiveRecord::Schema.define(version: 2020_05_30_100655) do
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# These are extensions that must be enabled in order to support this database
|
126
|
+
|
127
|
+
enable_extension "plpgsql"
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
create_table "posts", force: :cascade do |t|
|
132
|
+
|
133
|
+
t.string "url"
|
134
|
+
|
135
|
+
t.datetime "created_at", precision: 6, null: false
|
136
|
+
|
137
|
+
t.datetime "updated_at", precision: 6, null: false
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
create_table "users", force: :cascade do |t|
|
144
|
+
|
145
|
+
t.string "email", default: "", null: false
|
146
|
+
|
147
|
+
t.string "encrypted_password", default: "", null: false
|
148
|
+
|
149
|
+
t.string "reset_password_token"
|
150
|
+
|
151
|
+
t.datetime "reset_password_sent_at"
|
152
|
+
|
153
|
+
t.datetime "remember_created_at"
|
154
|
+
|
155
|
+
t.datetime "created_at", precision: 6, null: false
|
156
|
+
|
157
|
+
t.datetime "updated_at", precision: 6, null: false
|
158
|
+
|
159
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
160
|
+
|
161
|
+
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
create_table "videos", force: :cascade do |t|
|
168
|
+
|
169
|
+
t.string "video_id"
|
170
|
+
|
171
|
+
t.string "title"
|
172
|
+
|
173
|
+
t.string "setumei"
|
174
|
+
|
175
|
+
t.string "komento"
|
176
|
+
|
177
|
+
t.string "kategori"
|
178
|
+
|
179
|
+
t.float "star"
|
180
|
+
|
181
|
+
t.string "word"
|
182
|
+
|
183
|
+
t.datetime "created_at", precision: 6, null: false
|
184
|
+
|
185
|
+
t.datetime "updated_at", precision: 6, null: false
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
```
|
98
194
|
|
99
195
|
|
100
196
|
|