質問編集履歴
1
情報追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -369,3 +369,41 @@
|
|
369
369
|
end
|
370
370
|
|
371
371
|
```
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
酸味をlowに選択した時のパラメーターはこれです
|
376
|
+
|
377
|
+
```
|
378
|
+
|
379
|
+
[5] pry(#<DrinksController>)> params
|
380
|
+
|
381
|
+
=> <ActionController::Parameters {"q"=><ActionController::Parameters {"body_id_eq"=>"1", "acidity_id_eq"=>"2", "region_id_eq"=>"1", "processing_id_eq"=>"1"} permitted: false>, "commit"=>"検索", "controller"=>"drinks", "action"=>"search_drink"} permitted: false>
|
382
|
+
|
383
|
+
```
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
検索オブジェクト@pの結果はこれです
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
条件に一致する結果@resultsの配列は空でした
|
392
|
+
|
393
|
+
```
|
394
|
+
|
395
|
+
pry(#<DrinksController>)> @p
|
396
|
+
|
397
|
+
=> Ransack::Search<class: Drink, base: Grouping <conditions: [Condition <attributes: ["body_id"], predicate: eq, values: ["1"]>, Condition <attributes: ["acidity_id"], predicate: eq, values: ["2"]>, Condition <attributes: ["region_id"], predicate: eq, values: ["1"]>, Condition <attributes: ["processing_id"], predicate: eq, values: ["1"]>], combinator: and>>
|
398
|
+
|
399
|
+
[2] pry(#<DrinksController>)> @results
|
400
|
+
|
401
|
+
Drink Load (0.5ms) SELECT `drinks`.* FROM `drinks` WHERE (`drinks`.`body_id` = 1 AND `drinks`.`acidity_id` = 2 AND `drinks`.`region_id` = 1 AND `drinks`.`processing_id` = 1)
|
402
|
+
|
403
|
+
↳ app/controllers/drinks_controller.rb:52:in `search_drink'
|
404
|
+
|
405
|
+
=> []
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
```
|