Sha256: 90438b07f016a9fc9ec915b893758a0d563232a4842d24ce6655d4755bc66dd6
Contents?: true
Size: 952 Bytes
Versions: 32
Compression:
Stored size: 952 Bytes
Contents
module ThinkingSphinx module ActiveRecord module Scopes def self.included(base) base.class_eval do extend ThinkingSphinx::ActiveRecord::Scopes::ClassMethods end end module ClassMethods def sphinx_scope(method, &block) @sphinx_scopes ||= [] @sphinx_scopes << method metaclass.instance_eval do define_method(method) do |*args| options = {:classes => classes_option} options.merge! block.call(*args) ThinkingSphinx::Search.new(options) end end end def sphinx_scopes @sphinx_scopes || [] end def remove_sphinx_scopes sphinx_scopes.each do |scope| metaclass.send(:undef_method, scope) end sphinx_scopes.clear end end end end end
Version data entries
32 entries across 32 versions & 10 rubygems