Advertisement
hocikto19

generic autocomplete call

Aug 21st, 2016
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.31 KB | None | 0 0
  1. def autocomplete_city_name
  2.   common_user_autocomplete :name do
  3.     City.where("LOWER(UNACCENT(name)) like ?", term + '%')
  4.   end
  5. end
  6.  
  7. def autocomplete_category_name
  8.   common_user_autocomplete :name, [:level] do
  9.     CslCategory.where("LOWER(UNACCENT(name)) like ?", term + '%').order(left_bound: :desc)
  10.   end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement