Cross Reference: autocomplete_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
autocomplete_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
autocomplete_controller.rb revision acf37010abb588969e6843692a367f6be73e30cd
class
AutocompleteController
<
ActionController
::
Base
MIN_LENGTH
=
3
def
index
query
=
params
[:
query
]
.to_s.strip
if
query.length
<
MIN_LENGTH
@
result
= []
else
autocomplete
=
Autocomplete.new
(
params
[:
scope
],
query
)
@
result
=
autocomplete.result
end
rescue
Autocomplete
::
InvalidScope
=>
error
render
:
text
=>
error.message
, :
status
=> :
unprocessable_entity
end
end