My controller returns a json object with the fields “id”, “value” and an additional field “result_type”. Unfortunately I’m unable to access this “result_type” field in the select method.
I’m using Rails 3.2.6 with the jquery-rails and coffeescript gems. In application.js I require jquery-ui.
$('#q').autocomplete
source: (request, response) ->
...
select: (event,ui) ->
alert ui.item.value (works)
alert ui.item.result_type (does not work)
...
In the
source:section, I needed to add a line for result_type here: