Created
July 12, 2012 02:35
-
-
Save dabit/3095308 to your computer and use it in GitHub Desktop.
jquery-autocomplete hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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