diff options
author | Reverite <github@reverite.sh> | 2019-02-27 17:06:25 -0800 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-02-27 17:06:25 -0800 |
commit | 715c552fe4c1b2d59bf1f281d77b6e2546bdb531 (patch) | |
tree | 44e93d767f1b7cda48ff24020faa62675dd6140c /app/models/tag.rb | |
parent | 54e480ca0939ba737f5abdf4ee861cd63c025865 (diff) | |
parent | 76ed481aa7b67d624675cdaa85bac583853fd24d (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r-- | app/models/tag.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb index 4373e967b..788a678bd 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -64,9 +64,13 @@ class Tag < ApplicationRecord end class << self - def search_for(term, limit = 5) + def search_for(term, limit = 5, offset = 0) pattern = sanitize_sql_like(term.strip) + '%' - Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit) + + Tag.where('lower(name) like lower(?)', pattern) + .order(:name) + .limit(limit) + .offset(offset) end end |