Module: Elasticsearch::Model::Extensions::OuterDocumentUpdating::ClassMethods
- Defined in:
- lib/elasticsearch/model/extensions/outer_document_updating.rb
Defined Under Namespace
Modules: AssociationTraversal
Instance Method Summary collapse
- #has_dependent_fields? ⇒ Boolean
- #initialize_active_record!(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: block) ⇒ Object
- #nested_object_fields ⇒ Object
- #partially_updates_document_of(parent_class, options, &block) ⇒ Object
- #path_from(from) ⇒ Object
Instance Method Details
#has_dependent_fields? ⇒ Boolean
103 104 105 |
# File 'lib/elasticsearch/model/extensions/outer_document_updating.rb', line 103 def has_dependent_fields? @has_dependent_fields end |
#initialize_active_record!(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: block) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/elasticsearch/model/extensions/outer_document_updating.rb', line 114 def initialize_active_record!(active_record_class, parent_class: parent_class, delayed:, only_if: -> r { true }, records_to_update_documents: nil, field_to_update: nil, block: block) config = Elasticsearch::Model::Extensions::Configuration.new(active_record_class, parent_class: parent_class, delayed: delayed, only_if: binding.local_variable_get(:only_if), records_to_update_documents: records_to_update_documents, field_to_update: field_to_update, block: block ) active_record_class.after_commit Elasticsearch::Model::Extensions::UpdateCallback.new(config) active_record_class.after_commit Elasticsearch::Model::Extensions::DestroyCallback.new(config), on: :destroy end |
#nested_object_fields ⇒ Object
99 100 101 |
# File 'lib/elasticsearch/model/extensions/outer_document_updating.rb', line 99 def nested_object_fields @nested_object_fields end |
#partially_updates_document_of(parent_class, options, &block) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/elasticsearch/model/extensions/outer_document_updating.rb', line 124 def partially_updates_document_of(parent_class, , &block) ||= {} delayed = [:delayed] || nil only_if = [:if] || (-> r { true }) records_to_update_documents = [:records_to_update_documents] || nil field_to_update = [:field_to_update] || nil initialize_active_record!( self, :parent_class => parent_class, :delayed => delayed, :only_if => only_if, :field_to_update => field_to_update, :records_to_update_documents => records_to_update_documents, :block => block ) end |
#path_from(from) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/elasticsearch/model/extensions/outer_document_updating.rb', line 107 def path_from(from) Elasticsearch::Model::Extensions::MappingNode. from_class(from). breadth_first_search { |e| e.destination.relates_to_class?(self) }. first end |