Sha256: 92259b98925fae61d0a06caa1fff504f9ea3dd866fa3a164cc767829206e6248

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

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

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

    include Neo4j::Shared::Identity

    module ClassMethods
      def neo4j_session_name (name)
        @neo4j_session_name = name
      end

      def neo4j_session
        if @neo4j_session_name
          Neo4j::Session.named(@neo4j_session_name) || raise("#{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 = true

      def self.i18n_scope
        :neo4j
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neo4j-3.0.0.alpha.11 lib/neo4j/shared.rb
neo4j-3.0.0.alpha.10 lib/neo4j/shared.rb