mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 06:42:32 -05:00
allow to search on value
This commit is contained in:
1 parent
0844427357
commit
66eb83e6a7
3 files changed
+5
-3
No files matched your search
+3
-1
@@ -7,7 +7,7 @@ module Submissions
|
||||
|
||||
module_function
|
||||
|
||||
def search(submissions, keyword)
|
||||
def search(submissions, keyword, search_values: false)
|
||||
return submissions if keyword.blank?
|
||||
|
||||
term = "%#{keyword.downcase}%"
|
||||
@@ -18,6 +18,8 @@ module Submissions
|
||||
.or(arel_table[:phone].matches(term))
|
||||
.or(arel_table[:name].lower.matches(term))
|
||||
|
||||
arel = arel.or(Arel::Table.new(:submitters)[:values].matches(term)) if search_values
|
||||
|
||||
submissions.joins(:submitters).where(arel).distinct
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user