質問編集履歴
1
ユーザーモデル追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -224,6 +224,28 @@
|
|
224
224
|
|
225
225
|
|
226
226
|
|
227
|
+
```
|
228
|
+
|
229
|
+
class User < ApplicationRecord
|
230
|
+
|
231
|
+
before_save { self.email = email.downcase! }
|
232
|
+
|
233
|
+
validates :name, presence: true, length: { maximum:50 }
|
234
|
+
|
235
|
+
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(.[a-z\d\-]+)*.[a-z]+\z/i
|
236
|
+
|
237
|
+
validates :email, presence: true, length: { maximum: 255 },
|
238
|
+
|
239
|
+
format: { with: VALID_EMAIL_REGEX },
|
240
|
+
|
241
|
+
uniqueness: { case_sensitive: false }
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
```
|
246
|
+
|
247
|
+
|
248
|
+
|
227
249
|
### 試したこと
|
228
250
|
|
229
251
|
|