From 0ee5fc765c9334b3737b036bd7d12bc66b2be2eb Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 2 Mar 2022 14:39:44 -0800 Subject: [PATCH] Update weapon key method to have conditions We never want all keys, only ever a subset for the weapon we're currently working on --- app/controllers/api/v1/weapon_keys_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/weapon_keys_controller.rb b/app/controllers/api/v1/weapon_keys_controller.rb index cb4a641..b51ae6d 100644 --- a/app/controllers/api/v1/weapon_keys_controller.rb +++ b/app/controllers/api/v1/weapon_keys_controller.rb @@ -1,6 +1,11 @@ class Api::V1::WeaponKeysController < Api::V1::ApiController def all - @raids = WeaponKeys.all() + conditions = {} + conditions[:series] = request.params['series'] + conditions[:slot] = request.params['slot'] + conditions[:group] = request.params['group'] unless request.params['group'].blank? + + @keys = WeaponKey.where(conditions) render :all, status: :ok end end \ No newline at end of file