Sha256: 2372f338f11e7da275da16b3434fe7a5807b6b9df096824e962210c6e09da1fe

Contents?: true

Size: 730 Bytes

Versions: 31

Compression:

Stored size: 730 Bytes

Contents

module Searchlogic
  class Search
    module Base
      def self.included(klass)
        klass.class_eval do
          attr_accessor :klass, :current_scope
          undef :id if respond_to?(:id)
        end
      end
      
      # Creates a new search object for the given class. Ex:
      #
      #   Searchlogic::Search.new(User, {}, {:username_like => "bjohnson"})
      def initialize(klass, current_scope, conditions = {})
        self.klass = klass
        self.current_scope = current_scope
        @conditions ||= {}
        self.conditions = conditions if conditions.is_a?(Hash)
      end

      def clone
        self.class.new(klass, current_scope && current_scope.clone, conditions.clone)
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 4 rubygems

Version Path
searchlogic-2.5.19 lib/searchlogic/search/base.rb
searchlogic-2.5.18 lib/searchlogic/search/base.rb
searchlogic-2.5.17 lib/searchlogic/search/base.rb
searchlogic-2.5.16 lib/searchlogic/search/base.rb
searchlogic-2.5.15 lib/searchlogic/search/base.rb
searchlogic-2.5.14 lib/searchlogic/search/base.rb
searchlogic-2.5.13 lib/searchlogic/search/base.rb
searchlogic-2.5.12 lib/searchlogic/search/base.rb
searchlogic-2.5.11 lib/searchlogic/search/base.rb
searchlogic-2.5.10 lib/searchlogic/search/base.rb
searchlogic-2.5.9 lib/searchlogic/search/base.rb
searchlogic-2.5.8 lib/searchlogic/search/base.rb
searchlogic-2.5.7 lib/searchlogic/search/base.rb
searchlogic-2.5.6 lib/searchlogic/search/base.rb
searchlogic-2.5.5 lib/searchlogic/search/base.rb
searchlogic-2.5.4 lib/searchlogic/search/base.rb
searchlogic-2.5.3 lib/searchlogic/search/base.rb
searchlogic-2.5.2 lib/searchlogic/search/base.rb
searchlogic-2.5.1 lib/searchlogic/search/base.rb
searchlogic-2.5.0 lib/searchlogic/search/base.rb