Sha256: 3b83b883671f2d88cf09e53fc703693c07d02cedf521d0d80f5b3f7a85412b78

Contents?: true

Size: 1.36 KB

Versions: 81

Compression:

Stored size: 1.36 KB

Contents

module Neo4j
  module Shared
    extend ActiveSupport::Concern
    extend ActiveModel::Naming

    include ActiveModel::Conversion
    begin
    include ActiveModel::Serializers::Xml
    rescue NameError; end # rubocop:disable Lint/HandleExceptions
    include ActiveModel::Serializers::JSON

    module ClassMethods
      # TODO: Deprecate neo4j_session_name(name)

      # remove?
      def neo4j_session
        Neo4j::ActiveBase.current_session
      end

      # remove?
      def current_transaction
        Neo4j::ActiveBase.current_transaction
      end

      # This should be used everywhere.  Should make it easy
      # to support a session-per-model system
      def neo4j_query(*args)
        Neo4j::ActiveBase.query(*args)
      end

      def new_query
        Neo4j::ActiveBase.new_query
      end
    end

    included do
      self.include_root_in_json = Neo4j::Config.include_root_in_json
      @_declared_properties ||= Neo4j::Shared::DeclaredProperties.new(self)

      def self.i18n_scope
        :neo4j
      end

      def self.inherited(other)
        attributes.each_pair do |k, v|
          other.inherit_property k.to_sym, v.clone, declared_properties[k].options
        end
        super
      end
    end

    def declared_properties
      self.class.declared_properties
    end

    def neo4j_query(*args)
      self.class.neo4j_query(*args)
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
neo4j-8.0.5 lib/neo4j/shared.rb
neo4j-8.0.4 lib/neo4j/shared.rb
neo4j-8.0.3 lib/neo4j/shared.rb
neo4j-8.0.2 lib/neo4j/shared.rb
neo4j-8.0.1 lib/neo4j/shared.rb
neo4j-8.0.0 lib/neo4j/shared.rb
neo4j-8.0.0.rc.4 lib/neo4j/shared.rb
neo4j-8.0.0.rc.3 lib/neo4j/shared.rb
neo4j-8.0.0.rc.2 lib/neo4j/shared.rb
neo4j-8.0.0.rc.1 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.12 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.11 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.10 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.9 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.8 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.7 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.6 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.5 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.4 lib/neo4j/shared.rb
neo4j-8.0.0.alpha.2 lib/neo4j/shared.rb