lib/pg_search/model.rb in pg_search-2.3.6 vs lib/pg_search/model.rb in pg_search-2.3.7
- old
+ new
@@ -5,15 +5,15 @@
extend ActiveSupport::Concern
module ClassMethods
def pg_search_scope(name, options)
options_proc = if options.respond_to?(:call)
- options
- elsif options.respond_to?(:merge)
- ->(query) { { query: query }.merge(options) }
- else
- raise ArgumentError, 'pg_search_scope expects a Hash or Proc'
- end
+ options
+ elsif options.respond_to?(:merge)
+ ->(query) { {query: query}.merge(options) }
+ else
+ raise ArgumentError, "pg_search_scope expects a Hash or Proc"
+ end
define_singleton_method(name) do |*args|
config = Configuration.new(options_proc.call(*args), self)
scope_options = ScopeOptions.new(config)
scope_options.apply(self)