回答編集履歴
2
文法の修正
answer
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
def order_params
|
8
8
|
params.require(:order).permit(:no,
|
9
9
|
items_attributes: [:quantity, :price]).tap do |p|
|
10
|
-
p[:items_attributes].reject! { |i| i[:
|
10
|
+
p[:items_attributes].reject! { |i| i[:quantity].to_i.zero? }
|
11
11
|
end
|
12
12
|
end
|
13
13
|
```
|
1
文法の修正
answer
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
def order_params
|
8
8
|
params.require(:order).permit(:no,
|
9
9
|
items_attributes: [:quantity, :price]).tap do |p|
|
10
|
-
p[:items_attributes].reject! { |i| i[: quantity].to_i.zero?}
|
10
|
+
p[:items_attributes].reject! { |i| i[: quantity].to_i.zero? }
|
11
11
|
end
|
12
12
|
end
|
13
13
|
```
|