Skip to content

Instantly share code, notes, and snippets.

@dabit
Created July 12, 2012 02:35
Show Gist options
  • Save dabit/3095308 to your computer and use it in GitHub Desktop.
Save dabit/3095308 to your computer and use it in GitHub Desktop.
jquery-autocomplete hack
def json_for_autocomplete(items, method, extra_data=[])
items.collect do |item|
#
# Esta es la linea que importa, le estás diciendo a autocomplete que use nitprovedor como value
#
hash = {"id" => item.id.to_s, "label" => item.send(method), "value" => item.nitproveedor}
extra_data.each do |datum|
hash[datum] = item.send(datum)
end
hash
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment