Class: Xapit::Client::ActiveRecordAdapter
Class Method Summary
collapse
Instance Method Summary
collapse
adapter_class, inherited, #initialize
Class Method Details
.for_class?(model_class) ⇒ Boolean
4
5
6
|
# File 'lib/xapit/client/model_adapters/active_record_adapter.rb', line 4
def self.for_class?(model_class)
model_class <= ActiveRecord::Base
end
|
Instance Method Details
#index_all ⇒ Object
20
21
22
23
24
|
# File 'lib/xapit/client/model_adapters/active_record_adapter.rb', line 20
def index_all
@model_class.find_each do |member|
member.class.xapit_index_builder.add_document(member)
end
end
|
#setup ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/xapit/client/model_adapters/active_record_adapter.rb', line 8
def setup
@model_class.after_create do |member|
member.class.xapit_index_builder.add_document(member) if Xapit.config[:enabled]
end
@model_class.after_update do |member|
member.class.xapit_index_builder.update_document(member) if Xapit.config[:enabled]
end
@model_class.after_destroy do |member|
member.class.xapit_index_builder.remove_document(member) if Xapit.config[:enabled]
end
end
|