回答編集履歴

1

書式の改善

2019/03/21 01:21

投稿

yt10
yt10

スコア12

test CHANGED
@@ -12,11 +12,31 @@
12
12
 
13
13
 
14
14
 
15
+ ・データベースに保存される場合のuser.rb
15
16
 
16
17
 
18
+
17
- ```user.rb
19
+ ```Ruby
20
+
21
+ class User < ApplicationRecord
22
+
23
+ validates :email, {presence: true, uniqueness: true}
24
+
25
+ validates :password, {presence: true}
26
+
27
+ validates :name, presence: true, length: { maximum: 50 }
28
+
29
+ end
30
+
31
+ ```
18
32
 
19
33
 
34
+
35
+ ・データベースに保存されない場合のuser.rb
36
+
37
+
38
+
39
+ ```Ruby
20
40
 
21
41
  class User < ApplicationRecord
22
42