Add search for Characters

This commit is contained in:
Justin Edmund 2020-10-19 03:57:07 -07:00
parent 43130f69e0
commit be6a05124a
2 changed files with 9 additions and 0 deletions

View file

@ -1,4 +1,12 @@
class Api::V1::SearchController < Api::V1::ApiController
def characters
if params[:query].present?
@characters = Character.search(params[:query]).limit(10)
else
@characters = Character.all
end
end
def weapons
if params[:query].present?
@weapons = Weapon.search(params[:query]).limit(10)

View file

@ -12,6 +12,7 @@ Rails.application.routes.draw do
post 'check/email', to: 'users#check_email'
post 'check/username', to: 'users#check_username'
get 'search/characters', to: 'search#characters'
get 'search/weapons', to: 'search#weapons'
get 'search/summons', to: 'search#summons'