jQuery autocomplete list (ui-menu-item) does not populate
RoLoTo opened this issue · 2 comments
I had an issue using Rails 4.0.2, Ruby 2.1.0, rails3-jquery-autocomplete 1.0.12 which appeared right after a Rails update. Unsure if the update was related. The autocomplete would fire off, JSON would be returned however, the result from the rails server had the controller name added as a root to the JSON result. Adding this to my controller fixed it:
Turn off the adding a root element to the JSON serialization (the result MUST be a plain array)
def default_serializer_options
{root: false}
end
Possibly consider forcing this in autocomplete.rb?
render :json => json_for_autocomplete(items, options[:display_value] ||= method, options[:extra_data]), root: false
👍 I couldn't agree more. This should really be included by default. I'm going to setup a pull request for it.
Should be fixed by pull request #269