Open
Description
I don't see why the json returned always has to have the same value for label and value. A lot of actions would be simplified if I could return a column of my choosing (for e.g id) in the value field and search column in the label field.
def json_for_autocomplete(items, method, extra_data=[])
items.collect do |item|
hash = {"id" => item.id.to_s, "label" => item.send(method), "value" => item.send(method)}
extra_data.each do |datum|
hash[datum] = item.send(datum)
end if extra_data
# TODO: Come back to remove this if clause when test suite is better
hash
end
Metadata
Metadata
Assignees
Labels
No labels