Sha256: 2124655af08ccf9d7fd03202db3062a8e134717dc7b2305dd7e7652ee92ab32a

Contents?: true

Size: 808 Bytes

Versions: 5

Compression:

Stored size: 808 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
      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 = Neo4j::Config.include_root_in_json

      def self.i18n_scope
        :neo4j
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
neo4j-4.0.0 lib/neo4j/shared.rb
neo4j-4.0.0.rc.4 lib/neo4j/shared.rb
neo4j-4.0.0.rc.3 lib/neo4j/shared.rb
neo4j-4.0.0.rc.1 lib/neo4j/shared.rb
neo4j-3.0.4 lib/neo4j/shared.rb