0
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填充:Neo4j的RuntimeError:無會話中定義
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
方法,包括:
謝謝。這不是一個rails應用程序,所以不要使用配置文件。 – Angela
我看到了這個,所以我需要使用這個或者代替上面的代碼? #在JRuby或MRI中,使用Neo4j服務器模式。當railtie被包括時,這會自動發生。 Neo4j :: Session.open(:http)並且是:http一個符號,或者應該是具有憑據的grapheneFB URL? – Angela
我使用'save'獲得以下內容: client.save Neo4j :: DeprecatedSchemaDefinitionError:某些模式元素由模型定義(不再支持),但它們不存在於數據庫中。運行以下命令以創建它們: 耙的Neo4j:generate_schema_migration [約束,客戶端,UUID] 然後運行'耙的Neo4j:migrate' – Angela