Browse files

add Readme for :query and :mask options

  • Loading branch information...
1 parent 84545a5 commit ea117cbf059017fb23d940ab1ae2e58f9cfdaee3 @grosser committed Mar 11, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 Readme.md
View
7 Readme.md
@@ -36,6 +36,13 @@ With :match option you can filter for different columns
# return full_name of records for auto-completion
autocomplete_for :user, :full_name, :match => [:firstname, :lastname]
+With :query and :mask option you can change the generated query
+
+ # default: "LOWER(full_name) LIKE('%peter%')"
+ # now: "full_name LIKE('peter%') AND deleted_at IS NULL"
+ autocomplete_for :user, :full_name, :query => "%{field} LIKE(%{query}) AND deleted_at IS NULL", :mask => '%{value}%'
+
+
With a block you can generate any output you need (ERB allowed):
autocomplete_for :post, :title do |items|

0 comments on commit ea117cb

Please sign in to comment.