Module: Promiscuous::Subscriber::Mongoid::Root

Extended by:
ActiveSupport::Concern
Defined in:
lib/promiscuous/subscriber/mongoid/root.rb

Instance Method Summary collapse

Instance Method Details

#fetchObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/promiscuous/subscriber/mongoid/root.rb', line 4

def fetch
  case operation
  when :create
    klass.new.tap { |o| o.id = id }
  when :update
    klass.find(id)
  when :destroy
    klass.find(id)
  end
end

#processObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/promiscuous/subscriber/mongoid/root.rb', line 19

def process
  super
  case operation
  when :create
    instance.save!
  when :update
    instance.save!
  when :destroy
    instance.destroy
  end
end

#process_attributes?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/promiscuous/subscriber/mongoid/root.rb', line 15

def process_attributes?
  operation != :destroy
end