Autocomplete metatags (#2063)
This commit is contained in:
@@ -75,6 +75,10 @@ class TagSubscription < ActiveRecord::Base
|
||||
where("creator_id = ?", user.id)
|
||||
end
|
||||
|
||||
def name_matches(name)
|
||||
where("lower(name) like ? escape E'\\\\'", name.to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = scoped
|
||||
params = {} if params.blank?
|
||||
@@ -87,6 +91,10 @@ class TagSubscription < ActiveRecord::Base
|
||||
q = q.where("creator_id = ?", CurrentUser.user.id)
|
||||
end
|
||||
|
||||
if params[:name_matches]
|
||||
q = q.name_matches(params[:name_matches].mb_chars.downcase.strip.tr(" ", "_"))
|
||||
end
|
||||
|
||||
q = q.visible_to(CurrentUser.user)
|
||||
|
||||
q
|
||||
|
||||
Reference in New Issue
Block a user