Module: Tinia::Search

Defined in:
lib/tinia/search.rb

Defined Under Namespace

Modules: ClassMethods, WillPaginateMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tinia/search.rb', line 5

def self.included(klass)
  klass.send(:extend, ClassMethods)
  klass.class_eval do 
    # lambda block for the scope
    scope_def = lambda{|*ids|
      where("#{self.table_name}.#{self.primary_key} IN (?)", ids.flatten)
    }
    scope :tinia_scope, scope_def do 
      include WillPaginateMethods
    end
  end
end