about summary refs log tree commit diff
path: root/app/models/tag.rb
diff options
context:
space:
mode:
authormayaeh <mayaeh@marimo-net.org>2019-09-16 21:27:29 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-09-16 14:27:29 +0200
commitef0d22f232723be035e95bde13310d02bf1c127b (patch)
tree114a12ef4c032dda781ba112b44a0c8ab6de8afc /app/models/tag.rb
parentb7420b8643b4028796d1bbd9443241f997957eb4 (diff)
Add search and sort functions to hashtag admin UI (#11829)
* Add search and sort functions to hashtag admin UI

* Move scope processing from tags_controller to tag_filter

* Fix based on method naming conventions

* Fixed not to get 500 errors for invalid requests
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r--app/models/tag.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb
index a6aed0d68..4e77c404d 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -39,6 +39,7 @@ class Tag < ApplicationRecord
   scope :listable, -> { where(listable: [true, nil]) }
   scope :discoverable, -> { listable.joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) }
   scope :most_used, ->(account) { joins(:statuses).where(statuses: { account: account }).group(:id).order(Arel.sql('count(*) desc')) }
+  scope :matches_name, ->(value) { where(arel_table[:name].matches("#{value}%")) }
 
   delegate :accounts_count,
            :accounts_count=,