Class: Voluntary::Api::V1::ArgumentTopicsController

Inherits:
ActionController::Base
  • Object
show all
Includes:
V1::BaseController
Defined in:
app/controllers/voluntary/api/v1/argument_topics_controller.rb

Instance Method Summary collapse

Methods included from V1::BaseController

#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets

Instance Method Details

#autocompleteObject



9
10
11
12
13
14
# File 'app/controllers/voluntary/api/v1/argument_topics_controller.rb', line 9

def autocomplete
  render json: (
    ArgumentTopic.order(:name).where("name LIKE ?", "%#{params[:term]}%").
    map{|t| { id: t.id, value: t.name.truncate(50) }}
  ), root: false
end