Permalink
Browse files

if value is blank then display all values

  • Loading branch information...
1 parent 1b31a49 commit a442f70d89c1a8061e1483b5d2907afff59fa484 @BeenaShetty committed Mar 13, 2013
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/rails3-jquery-autocomplete/autocomplete.rb
@@ -46,17 +46,13 @@ def autocomplete(object, method, options = {})
method = options[:column_name] if options.has_key?(:column_name)
- term = params[:term]
-
- if term && !term.blank?
- #allow specifying fully qualified class name for model object
+ term = params[:term].blank? ? "" : params[:term
+
+ #allow specifying fully qualified class name for model object
class_name = options[:class_name] || object
items = get_autocomplete_items(:model => get_object(class_name), \
:options => options, :term => term, :method => method)
- else
- items = {}
- end
-
+
render :json => json_for_autocomplete(items, options[:display_value] ||= method, options[:extra_data])
end
end

0 comments on commit a442f70

Please sign in to comment.