Module: Tinia::ActiveRecord

Defined in:
lib/tinia.rb

Instance Method Summary collapse

Instance Method Details

#indexed_with_cloud_search {|_self| ... } ⇒ Object

activation method for an AR class

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tinia.rb', line 22

def indexed_with_cloud_search(&block)
  mods = [
    Tinia::Connection,
    Tinia::Index,
    Tinia::Search
  ]
  mods.each do |mod|
    unless self.included_modules.include?(mod)
      self.send(:include, mod) 
    end
  end
  # config block
  yield(self) if block_given?

  # ensure config is all set
  unless self.cloud_search_domain.present?
    raise Tinia::MissingSearchDomain.new(self)
  end
end