teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

文法の修正

2020/10/31 07:16

投稿

fkm_y
fkm_y

スコア36

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
  ```

1

文法の修正

2020/10/31 07:16

投稿

fkm_y
fkm_y

スコア36

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
  ```