diff --git a/app/controllers/yiff_rest/api_v2_controller.rb b/app/controllers/yiff_rest/api_v2_controller.rb index 275f944..1fc1711 100644 --- a/app/controllers/yiff_rest/api_v2_controller.rb +++ b/app/controllers/yiff_rest/api_v2_controller.rb @@ -76,7 +76,7 @@ module YiffRest render(json: { success: true, data: { - **APIImage.categories.find { |c| c.db == category }, + **APIImage.categories.find { |c| c.db == category }.to_h, count: count, }, }) diff --git a/app/logical/api_category.rb b/app/logical/api_category.rb index ce10715..35a7f57 100644 --- a/app/logical/api_category.rb +++ b/app/logical/api_category.rb @@ -61,4 +61,6 @@ class APICategory count: count, } end + + alias to_h as_json end