Sha256: 55b73b18c9dc1e5cf994da5d69dccdfb30425deec710fda5d48c54cfdbd2b2a3

Contents?: true

Size: 649 Bytes

Versions: 42

Compression:

Stored size: 649 Bytes

Contents

module ActiveGraph
  module Relationship
    module Callbacks #:nodoc:
      extend ActiveSupport::Concern
      include ActiveGraph::Shared::Callbacks

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

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

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
activegraph-10.0.0.pre.beta.2 lib/active_graph/relationship/callbacks.rb
activegraph-10.0.0.pre.beta.1 lib/active_graph/relationship/callbacks.rb