Sha256: 47383b3386efe5a433ca2e3137796050a455f5c42c82ac44395f44e120bbab6b

Contents?: true

Size: 839 Bytes

Versions: 8

Compression:

Stored size: 839 Bytes

Contents

module Neo4j
  module ActiveNode
    module Callbacks #:nodoc:
      extend ActiveSupport::Concern

      module ClassMethods
        include ActiveModel::Callbacks
      end

      included do
        include ActiveModel::Validations::Callbacks

        define_model_callbacks :initialize, :find, :only => :after
        define_model_callbacks :save, :create, :update, :destroy
      end

      def destroy #:nodoc:
        run_callbacks(:destroy) { super }
      end

      def touch(*) #:nodoc:
        run_callbacks(:touch) { super }
      end

      private

      def create_or_update #:nodoc:
        run_callbacks(:save) { super }
      end

      def create_model #:nodoc:
        run_callbacks(:create) { super }
      end

      def update_model(*) #:nodoc:
        run_callbacks(:update) { super }
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
neo4j-3.0.0.alpha.9 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.8 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.7 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.6 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.5 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.4 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.3 lib/neo4j/active_node/callbacks.rb
neo4j-3.0.0.alpha.2 lib/neo4j/active_node/callbacks.rb