Module: Neo4j::Rails::TxMethods

Included in:
Attributes, NestedAttributes, NodePersistence, Persistence, RelationshipPersistence
Defined in:
lib/neo4j/rails/tx_methods.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) tx_methods(*methods)



4
5
6
7
8
9
10
11
12
# File 'lib/neo4j/rails/tx_methods.rb', line 4

def tx_methods(*methods)
  methods.each do |method|
    tx_method = "#{method}_in_tx"
    send(:alias_method, tx_method, method)
    send(:define_method, method) do |*args|
      Neo4j::Rails::Transaction.run { send(tx_method, *args) }
    end
  end
end