質問編集履歴
3
if文変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,18 +50,14 @@
|
|
50
50
|
|
51
51
|
User/indexで下記のように記載すると
|
52
52
|
|
53
|
-
undefined method `orders' for nil:NilClass
|
54
|
-
|
55
|
-
となってしまいます。
|
53
|
+
該当するデータがあるのに表示されない状態となってしまいます。
|
56
54
|
|
57
55
|
|
58
56
|
|
59
|
-
-
|
57
|
+
- user.user_profile.present? && user.user_profile.orders.present?
|
60
58
|
|
61
|
-
-
|
59
|
+
- user.user_profile.orders.each do |orders|
|
62
60
|
|
63
|
-
- user.user_profile.orders.each do |order|
|
64
|
-
|
65
|
-
|
61
|
+
= orders.email
|
66
62
|
|
67
63
|
```
|
2
if文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
User/indexで下記のように記載すると
|
52
52
|
|
53
|
-
undefined method `
|
53
|
+
undefined method `orders' for nil:NilClass
|
54
54
|
|
55
55
|
となってしまいます。
|
56
56
|
|
@@ -58,6 +58,10 @@
|
|
58
58
|
|
59
59
|
- @users.each do |user|
|
60
60
|
|
61
|
+
- if user.user_profile.orders.present?
|
62
|
+
|
61
|
-
|
63
|
+
- user.user_profile.orders.each do |order|
|
64
|
+
|
65
|
+
= order.total_price
|
62
66
|
|
63
67
|
```
|
1
typoの修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Railsでemail
|
1
|
+
Railsでemailがマッチするデータをviewsで表示したい
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
User_profile
|
19
|
+
User_profile
|
20
20
|
|
21
21
|
belongs_to : user
|
22
22
|
|