From a88286355143f5ae5b24839d66d8c0b3f87586d7 Mon Sep 17 00:00:00 2001 From: Daniel Kirsch Date: Tue, 21 Feb 2012 16:40:06 +0100 Subject: [PATCH] Restore possibility to send custom JSON (because it's not only useful to set a different encoder...) --- lib/rails3-jquery-autocomplete/autocomplete.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rails3-jquery-autocomplete/autocomplete.rb b/lib/rails3-jquery-autocomplete/autocomplete.rb index fefc9146..e7c56190 100644 --- a/lib/rails3-jquery-autocomplete/autocomplete.rb +++ b/lib/rails3-jquery-autocomplete/autocomplete.rb @@ -57,7 +57,11 @@ def autocomplete(object, method, options = {}) items = {} end - render :json => json_for_autocomplete(items, options[:display_value] ||= method, options[:extra_data]) + render :json => if block_given? + yield items + else + json_for_autocomplete(items, options[:display_value] ||= method, options[:extra_data]) + end end end end