Module: XBar::Rails2::Persistence

Defined in:
lib/xbar/rails2/persistence.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/xbar/rails2/persistence.rb', line 4

def self.included(base)
  base.instance_eval do
    alias_method_chain :destroy, :xbar
    alias_method_chain :delete, :xbar
    alias_method_chain :reload, :xbar
  end
end

Instance Method Details

#delete_with_xbarObject



12
13
14
15
16
17
18
# File 'lib/xbar/rails2/persistence.rb', line 12

def delete_with_xbar()
  if should_set_current_shard?
    XBar.using(self.current_shard) { delete_without_xbar() }
  else
    delete_without_xbar()
  end
end

#destroy_with_xbarObject



20
21
22
23
24
25
26
# File 'lib/xbar/rails2/persistence.rb', line 20

def destroy_with_xbar()
  if should_set_current_shard?
    XBar.using(self.current_shard) { destroy_without_xbar() }
  else
    destroy_without_xbar()
  end
end

#reload_with_xbar(options = nil) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/xbar/rails2/persistence.rb', line 28

def reload_with_xbar(options = nil)
  if should_set_current_shard?
    XBar.using(self.current_shard) { reload_without_xbar(options) }
  else
    reload_without_xbar(options)
  end
end