Class: AuthoritiesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/authorities_controller.rb

Instance Method Summary collapse

Instance Method Details

#queryObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/authorities_controller.rb', line 5

def query
  s = params.fetch("q", "")
  hits =
    if params[:term] == "location"
      GeoNamesResource.find_location(s)
    else
      begin
        LocalAuthority.entries_by_term(params[:model], params[:term], s)
      rescue
        []
      end
    end
  render json: hits
end