【发布时间】:2017-04-21 06:05:29
【问题描述】:
class Client
=begin
Clients are individual users
=end
include Neo4j::ActiveNode
include Neo4j::UndeclaredProperties
include Neo4j::Timestamps # will give model created_at and updated_at timestamps
property :bot_client_id
property :sms
property :telegram_id
property :first_name
property :last_name
property :email
end
当我创建一个新节点时,没有填充 uuid:
client = Client.new
当我尝试查找已创建的客户端时,出现运行时错误:
client = Client.find_by(bot_client_id: 'botid')
错误详情:
RuntimeError: No session defined!
from /usr/local/rvm/gems/ruby-2.2.1/gems/neo4j-8.0.13/lib/neo4j/active_base.rb:9:in `block in current_session'
from /usr/local/rvm/gems/ruby-2.2.1/gems/neo4j-8.0.13/lib/neo4j/active_base.rb:8:in `tap'
from /usr/local/rvm/gems/ruby-2.2.1/gems/neo4j-8.0.13/lib/neo4j/active_base.rb:8:in `current_session'
from /usr/local/rvm/gems/ruby-2.2.1/gems/neo4j-8.0.13/lib/neo4j/model_schema.rb:35:in `model_constraints'
from /usr/local/rvm/gems/ruby-2.2.1/gems/neo4j-8.0.13/lib/neo4j/model_schema.rb:131:in `each_schema_element'
我有一个def initialize 方法,其中包括:
neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::HTTP.new('http://user:pass@host:7474')
Neo4j::ActiveBase.on_establish_session { Neo4j::Core::CypherSession.new(neo4j_adaptor) }
【问题讨论】: