Module: XBar::SingularAssociation

Defined in:
lib/xbar/rails3.1/singular_association.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/xbar/rails3.1/singular_association.rb', line 2

def self.included(base)
  base.instance_eval do
    alias_method_chain :reader, :xbar
    alias_method_chain :writer, :xbar
    alias_method_chain :create, :xbar
    alias_method_chain :create!, :xbar
    alias_method_chain :build, :xbar
  end
end

Instance Method Details

#build_with_xbar(*args) ⇒ Object



28
29
30
# File 'lib/xbar/rails3.1/singular_association.rb', line 28

def build_with_xbar(*args)
  owner.reload_connection_safe { build_without_xbar(*args) }
end

#create_with_xbar(*args) ⇒ Object



20
21
22
# File 'lib/xbar/rails3.1/singular_association.rb', line 20

def create_with_xbar(*args)
  owner.reload_connection_safe { create_without_xbar(*args) }
end

#create_with_xbar!(*args) ⇒ Object



24
25
26
# File 'lib/xbar/rails3.1/singular_association.rb', line 24

def create_with_xbar!(*args)
  owner.reload_connection_safe { create_without_xbar!(*args) }
end

#reader_with_xbar(*args) ⇒ Object



12
13
14
# File 'lib/xbar/rails3.1/singular_association.rb', line 12

def reader_with_xbar(*args)
  owner.reload_connection_safe { reader_without_xbar(*args) }
end

#writer_with_xbar(*args) ⇒ Object



16
17
18
# File 'lib/xbar/rails3.1/singular_association.rb', line 16

def writer_with_xbar(*args)
  owner.reload_connection_safe { writer_without_xbar(*args) }
end