Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/pg_search/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def alias(*strings)
end
end

def default_scope
return nil unless options[:default_scope]

options[:default_scope]
end

def columns
regular_columns + associated_columns
end
Expand Down Expand Up @@ -84,7 +90,7 @@ def default_options
end

VALID_KEYS = %w[
against ranked_by ignoring using query associated_against order_within_rank
against ranked_by ignoring using query associated_against order_within_rank default_scope
].map(&:to_sym)

VALID_VALUES = {
Expand Down
1 change: 1 addition & 0 deletions lib/pg_search/scope_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def subquery
.select("#{primary_key} AS pg_search_id")
.select("#{rank} AS rank")
.joins(subquery_join)
.where(config.default_scope)
.where(conditions)
.limit(nil)
.offset(nil)
Expand Down