Sha256: d3dc2a3b930177bc9bfd5cca38e9b83ab477b78748d9d2098dde819c417684cf

Contents?: true

Size: 361 Bytes

Versions: 2

Compression:

Stored size: 361 Bytes

Contents

module Neo4j::TxMethods
  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.running? ? send(tx_method, *args) : Neo4j::Rails::Transaction.run { send(tx_method, *args) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.11 lib/neo4j/rails/tx_methods.rb
neo4j-1.0.0.beta.10 lib/neo4j/rails/tx_methods.rb