Skip to content

Commit

Permalink
Merge pull request #1444 from dmitry-sinina/fix_numberlist_filter
Browse files Browse the repository at this point in the history
fix numberlists search
  • Loading branch information
dmitry-sinina authored Mar 12, 2024
2 parents cc43a20 + fcb9e67 commit 7d9c90d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/models/routing/numberlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ class Routing::Numberlist < ApplicationRecord
MODE_RANDOM => 'Random'
}.freeze

class << self
def ransackable_scopes(_auth_object = nil)
%i[
search_for
]
end
end

attribute :external_type, :string_presence

belongs_to :tag_action, class_name: 'Routing::TagAction', optional: true
Expand Down Expand Up @@ -82,6 +90,8 @@ class Routing::Numberlist < ApplicationRecord

validates_with TagActionValueValidator

scope :search_for, ->(term) { where("numberlists.name || ' | ' || numberlists.id::varchar ILIKE ?", "%#{term}%") }

def display_name
"#{name} | #{id}"
end
Expand Down

0 comments on commit 7d9c90d

Please sign in to comment.