Class: Promiscuous::Publisher::Model::Mongoid::PromiscuousMethods
- Inherits:
-
Object
- Object
- Promiscuous::Publisher::Model::Mongoid::PromiscuousMethods
show all
- Includes:
- Base::PromiscuousMethodsBase
- Defined in:
- lib/promiscuous/publisher/model/mongoid.rb
Instance Method Summary
collapse
#attributes, #get_dependency, #id, #initialize, #payload
Instance Method Details
#attribute(attr) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/promiscuous/publisher/model/mongoid.rb', line 31
def attribute(attr)
value = super
if value.is_a?(Array) &&
value.respond_to?(:ancestors) &&
value.ancestors.any? { |a| a == Promiscuous::Publisher::Model::Mongoid }
value = {:types => ['Promiscuous::EmbeddedDocs'],
:attributes => value.map(&:promiscuous).map(&:payload)}
end
value
end
|
#sync(options = {}, &block) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/promiscuous/publisher/model/mongoid.rb', line 24
def sync(options={}, &block)
raise "Use promiscuous.sync on the parent instance" if @instance.embedded?
Promiscuous::Publisher::Operation::Ephemeral.new(:instance => @instance, :operation => :update).execute
end
|