Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix autocomplete valuelist filter to actually filter on terms

  • Loading branch information...
commit d4beeafd1c0b303082312767574d1225e138dde7 1 parent a0d46c3
@aviflombaum authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 app/controllers/value_lists_controller.rb
View
8 app/controllers/value_lists_controller.rb
@@ -13,11 +13,15 @@ def index
end
format.json do
if value_list = ValueList.first(:conditions => ["value = ?", params[:value]])
- values = value_list.values.map(&:value)
+ values = if params[:term].present?
+ value_list.values.find(:all, :conditions => ["values.value LIKE ?", "%#{params[:term]}%"])
+ else
+ value_list.values
+ end
else
values = []
end
- render :json => values
+ render :json => values.map(&:value)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.