Sha256: 5e32eda18be65ea1802ee7aa4d1d9f4fbc2ff5288fe126275a545c20fa4161f3

Contents?: true

Size: 1004 Bytes

Versions: 6

Compression:

Stored size: 1004 Bytes

Contents

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

    include ActiveModel::Conversion
    include ActiveModel::Serializers::Xml
    include ActiveModel::Serializers::JSON

    module ClassMethods
      attr_writer :neo4j_session_name

      def neo4j_session_name(name)
        ActiveSupport::Deprecation.warn 'neo4j_session_name is deprecated and may be removed from future releases, use neo4j_session_name= instead.', caller

        @neo4j_session_name = name
      end

      def neo4j_session
        if @neo4j_session_name
          Neo4j::Session.named(@neo4j_session_name) || fail("#{self.name} is configured to use a neo4j session named #{@neo4j_session_name}, but no such session is registered with Neo4j::Session")
        else
          Neo4j::Session.current!
        end
      end
    end

    included do
      self.include_root_in_json = Neo4j::Config.include_root_in_json

      def self.i18n_scope
        :neo4j
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
neo4j-4.1.5 lib/neo4j/shared.rb
neo4j-4.1.4 lib/neo4j/shared.rb
neo4j-4.1.3 lib/neo4j/shared.rb
neo4j-4.1.2 lib/neo4j/shared.rb
neo4j-4.1.1 lib/neo4j/shared.rb
neo4j-4.1.0 lib/neo4j/shared.rb