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

回答編集履歴

1

修正

2019/01/08 05:53

投稿

退会済みユーザー
answer CHANGED
@@ -1,8 +1,15 @@
1
- > ```rb
2
- assigns(:product)
1
+ []とか()はどっちでもよさそうでした。
3
- > ```
4
2
 
5
- ```rb
6
- assigns[:product]
7
- # ^ ^
8
- ```
3
+ 期待される値
4
+ ```
5
+ [#<Spree::Product id: 576, name: "Product #20 - 5006", description: "As seen on TV!", available_on: "...at: "2019-01-08 04:48:35", updated_at: "2019-01-08 04:48:35", promotionable: true, meta_title: nil>]
6
+ ```
7
+ 取得した値
8
+ ```
9
+ []
10
+ ```
11
+ 不足分
12
+ ```
13
+ [#<Spree::Product id: 576, name: "Product #20 - 5006", description: "As seen on TV!", available_on: "...at: "2019-01-08 04:48:35", updated_at: "2019-01-08 04:48:35", promotionable: true, meta_title: nil>]
14
+ ```
15
+ となってるのでプロダクトコードのインスタンス変数が空の配列になってるのではないでしょうか。