Neo4j.rb中的Rails 6是否有开发?在一个新的rails 6(rc1(项目中,如果我创建几个脚手架然后运行'rake neo4j:migrate:all',我会收到一个错误,当我快速遵循它时,兔子洞比我可以解析的更深入地进入ActiveModel的内部:
NoMethodError: undefined method `force_change' for #<ActiveModel::NullMutationTracker:0x00007fa1aadd8788>
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/activemodel-6.0.0.rc1/lib/active_model/dirty.rb:268:in `attribute_will_change!'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/activemodel-6.0.0.rc1/lib/active_model/attribute_methods.rb:383:in `migration_id_will_change!'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/property.rb:213:in `block in attribute!'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/property.rb:51:in `block in send_props'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/property.rb:51:in `each'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/property.rb:51:in `send_props'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/property.rb:32:in `initialize'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/active_node/property.rb:7:in `initialize'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/callbacks.rb:19:in `block in initialize'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/callbacks.rb:101:in `run_callbacks'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/shared/callbacks.rb:19:in `initialize'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/active_node.rb:53:in `initialize'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/active_node/persistence.rb:116:in `new'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/active_node/persistence.rb:116:in `create!'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/base.rb:31:in `migrate_up'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/base.rb:16:in `block in migrate'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/base.rb:15:in `migrate'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:127:in `block in migrate'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:133:in `migration_message'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:125:in `migrate'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:26:in `block in all'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:24:in `each'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/migrations/runner.rb:24:in `all'
/Users/metkat/.rvm/gems/ruby-2.6.0/gems/neo4j-9.2.4/lib/neo4j/tasks/migration.rake:116:in `block (3 levels) in <main>'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/Users/metkat/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/Users/metkat/.rvm/gems/ruby-2.6.0/bin/rake:23:in `load'
/Users/metkat/.rvm/gems/ruby-2.6.0/bin/rake:23:in `<main>'
/Users/metkat/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `eval'
/Users/metkat/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => neo4j:migrate:all
它通过此拉取请求修复。neo4jrb
版本9.6.0
及以后。
看起来它与登陆 RC1 的这个 PR 有关,我遇到了同样的问题。我 ping 了该线程以查看它是否是故意的。同时,尝试回滚到上一个测试版或猴子修补ActiveModel::NullMutationTracker
(这是我所做的并确认它解决了问题(,方法是将以下方法添加回去:
def forget_change(attr_name)
end
def original_value(attr_name)
end
def force_change(attr_name)
end