Add search for Characters
This commit is contained in:
parent
43130f69e0
commit
be6a05124a
2 changed files with 9 additions and 0 deletions
|
|
@ -1,4 +1,12 @@
|
||||||
class Api::V1::SearchController < Api::V1::ApiController
|
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
|
def weapons
|
||||||
if params[:query].present?
|
if params[:query].present?
|
||||||
@weapons = Weapon.search(params[:query]).limit(10)
|
@weapons = Weapon.search(params[:query]).limit(10)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ Rails.application.routes.draw do
|
||||||
post 'check/email', to: 'users#check_email'
|
post 'check/email', to: 'users#check_email'
|
||||||
post 'check/username', to: 'users#check_username'
|
post 'check/username', to: 'users#check_username'
|
||||||
|
|
||||||
|
get 'search/characters', to: 'search#characters'
|
||||||
get 'search/weapons', to: 'search#weapons'
|
get 'search/weapons', to: 'search#weapons'
|
||||||
get 'search/summons', to: 'search#summons'
|
get 'search/summons', to: 'search#summons'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue