Sha256: 815b6806dc82673b2c54c061283cab0f551748f6b80a0637c987260db067a621

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

module Neo4j
  module ActiveRel
    module Callbacks #:nodoc:
      extend ActiveSupport::Concern
      include Neo4j::Shared::Callbacks

      def save(*args)
        unless _persisted_obj || (from_node.respond_to?(:neo_id) && to_node.respond_to?(:neo_id))
          fail Neo4j::ActiveRel::Persistence::RelInvalidError, 'from_node and to_node must be node objects'
        end
        super(*args)
      end

      def destroy
        to_node.callbacks_from_active_rel(self, :in, from_node).try(:last)
        from_node.callbacks_from_active_rel(self, :out, to_node).try(:last)
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activegraph-10.0.0.pre.alpha.11 lib/neo4j/active_rel/callbacks.rb
activegraph-10.0.0.pre.alpha.10 lib/neo4j/active_rel/callbacks.rb
activegraph-10.0.0.pre.alpha.9 lib/neo4j/active_rel/callbacks.rb
activegraph-10.0.0.pre.alpha.8 lib/neo4j/active_rel/callbacks.rb