回答編集履歴
1
追記
answer
CHANGED
@@ -6,6 +6,13 @@
|
|
6
6
|
```
|
7
7
|
こんな感じ?
|
8
8
|
|
9
|
+
#### 追記
|
10
|
+
飲み物が決まっているなら、
|
11
|
+
```ruby
|
12
|
+
@happy_sets = Happyset.joins(:drinks, :happyset_drinks).where(happyset_drinks: {quantity: 数字}).where(drinks: {name: 'cola'})
|
13
|
+
```
|
14
|
+
formを開いた時点で飲み物が決まっているなら、hidden_field等で飲み物の名前を送ってやればいいと思います。
|
15
|
+
|
9
16
|
### 疑問2
|
10
17
|
whereはActiveRecordクラスではなく、ActiveRecord::Relationクラスが返ってきます。
|
11
18
|
ActiveRecordの配列のようなもので、そこには複数のActiveRecordが入るようになります。
|