crowdint/rails3-jquery-autocomplete — Issue #144: Display image in the result
Author: jerryshen
Created: 2012-02-24 03:47:08+00:00
State: open

How can I configure the result to render a image?

```ruby
def json_for_autocomplete(items, method, extra_data=[])
items.collect do |item|
if item.is_a?(Category)
hash = {"id" => item.id.to_s, "label" => item.send('photo').html_safe, "value" => item.send(method)}
else
hash = {"id" => item.id.to_s, "label" => item.send(method), "value" => item.send(method)}
end

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
end
```

I modify the method like this, but it rendered a string as ''
How can I render a image in the list? thanks