Commit 3126ba8b authored by mgabdev's avatar mgabdev

Added search_for function on group

parent 6581ac5a
......@@ -43,6 +43,17 @@ class Group < ApplicationRecord
before_destroy :clean_feed_manager
after_create :add_owner_to_accounts
class << self
def search_for(term, limit = 100, offset = 0)
pattern = sanitize_sql_like(term.strip) + '%'
Group.where('lower(title) like lower(?) AND is_archived=false', pattern)
.order(:title)
.limit(limit)
.offset(offset)
end
end
private
def add_owner_to_accounts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment