Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit 186ca7c

Browse files
committed
finish pg_search by getting configuration option from adapter
1 parent 650722e commit 186ca7c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/presenters/teams/pg_searching.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def search(query, teams)
1313
matching_encryptable_ids = Encryptable.where({ id: allowed_encryptables }).search_by_name(query).pluck :id
1414

1515
# Join allowed tables together and return matching ones
16-
binding.pry
1716
teams.where('encryptables.id IN (:encryptable_ids) OR teams.id IN (:team_ids) OR folders.id IN (:folder_ids)',
1817
encryptable_ids: matching_encryptable_ids, team_ids: matching_team_ids, folder_ids: matching_folder_ids)
1918
.references(:folders,

app/presenters/teams/search_strategy.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
module ::Teams
44
class SearchStrategy
55
def search(query, teams)
6-
if Rails.configuration.database_configuration[Rails.env]['database'].include?('postgres')
6+
if get_database_adapter.include?('postgres')
77
PgSearching.new.search(query, teams)
88
else
99
SqlSearch.new.search(query, teams)
1010
end
1111
end
12+
13+
def get_database_adapter
14+
Rails.configuration.database_configuration[Rails.env]['adapter']
15+
end
1216
end
1317
end

0 commit comments

Comments
 (0)