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