diff options
author | ThibG <thib@sitedethib.com> | 2019-02-26 21:40:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-26 21:40:28 +0100 |
commit | ff2270cd061b2dc3fc86a5b2bd77d0a3408b5716 (patch) | |
tree | 75adb7dc4d3c37ecf87b43659538e20ec198d804 /app/models/tag.rb | |
parent | d82de360c13894746d3974d11c9505c8937ebdee (diff) | |
parent | 1e06ca1c0af98cf61b1114b93249fb447e795edb (diff) |
Merge pull request #930 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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 |