Module: PgSearch::Model::ClassMethods
- Defined in:
- lib/pg_search/model.rb
Instance Method Summary collapse
Instance Method Details
#multisearchable(options = {}) ⇒ Object
24 25 26 27 28 |
# File 'lib/pg_search/model.rb', line 24 def multisearchable( = {}) include PgSearch::Multisearchable class_attribute :pg_search_multisearchable_options self. = end |
#pg_search_scope(name, options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pg_search/model.rb', line 8 def pg_search_scope(name, ) = if .respond_to?(:call) elsif .respond_to?(:merge) ->(query) { { query: query }.merge() } else raise ArgumentError, 'pg_search_scope expects a Hash or Proc' end define_singleton_method(name) do |*args| config = Configuration.new(.call(*args), self) = ScopeOptions.new(config) .apply(self) end end |