Skip to content

Commit f375e5b

Browse files
Merge pull request risuiowa#2 from juanpedrojose/fix-regression
Fix regression(missing extra_data)
2 parents efa2542 + e59a4c7 commit f375e5b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/rails-jquery-autocomplete/autocomplete.rb

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ def get_object(model_sym)
9999
def json_for_autocomplete(items, method, extra_data=[], extra_methods=[])
100100
items = items.collect do |item|
101101
hash = HashWithIndifferentAccess.new({"id" => item.id.to_s, "label" => item.send(method), "value" => item.send(method)})
102+
extra_data.each do |datum|
103+
hash[datum] = item.send(datum)
104+
end if extra_data
102105
extra_methods.each do |datum|
103106
hash[datum] = item.send(datum)
104107
end if extra_methods

0 commit comments

Comments
 (0)