crowdint / rails3-jquery-autocomplete

An easy and unobtrusive way to use jQuery's autocomplete with Rails 3

Home Page:http://rubygems.org/gems/rails3-jquery-autocomplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoMethodError - undefined method `id' for #<Hash

Lyubomyr opened this issue · comments

I had an issue using Rails 4.0.2, Ruby 2.1.0, rails3-jquery-autocomplete 1.0.13, ActiveRecord, PostgreSQL, right after update to last version of gem:

"NoMethodError - undefined method `id' for #Hash:0x00000005b47120"
when autocomplite method call.

Think it's after your update:
-items.collect! do |item|
+items = items.collect do |item|

For now fix by monkey patch:
def json_for_autocomplete(items, method, extra_data=[])
items = items.to_a.collect do |item|
...

This was fixed on master. You can point to GitHub temporarily if you need to; I will be pushing an updated gem to rubygems by this weekend.

Good. Thanks.