Module: CloudSearchRails::ActiveRecord
- Defined in:
- lib/cloud_search_rails.rb
Instance Method Summary collapse
-
#indexed_with_cloud_search {|_self| ... } ⇒ Object
activation method for an AR class.
Instance Method Details
#indexed_with_cloud_search {|_self| ... } ⇒ Object
activation method for an AR class
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cloud_search_rails.rb', line 26 def indexed_with_cloud_search(&block) mods = [ CloudSearchRails::Connection, CloudSearchRails::Index, CloudSearchRails::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 CloudSearchRails::MissingSearchDomain.new(self) end end |