You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error only happens in development mode, and only when a change is made to files and therefore code is reloaded.
The error message, for example, is NoMethodError - undefined method 'name' for #<Neo4j::Core::Node:0x00007f960c7bc858>
where 'name' is one of the properties on one of our nodes (note that the error can happen equally on properties or relationships):
# this is just a snippet
module BitFarm
class Lesson
include Neo4j::ActiveNode
include Neo4j::Timestamps
self.mapped_label_name = 'Lesson'
property :name
end
end
In trying to figure out why we're having this issue, I can only surmise that it might have something to do with the fact that we are using the neo4j gem within a gem of our own (called 'bit_farm'), which is in turn required by our Rails app.
I've tried various things to attempt to address the issue, including setting up a railtie in bit_farm which calls Neo4j::ActiveNode::Labels::Reloading.reload_models! but this does not do anything, as Neo4j::ActiveNode::Labels::Reloading::MODELS_TO_RELOAD appears to be an empty array at that point.
FWIW this was the railtie:
module BitFarm
class Railtie < ::Rails::Railtie
config.to_prepare do
Neo4j::ActiveNode::Labels::Reloading.reload_models!
end
end
end
I am fairly certain that the code in neo4j/lib/neo4j/railtie.rb is being executed before the code in our railtie (not sure if that might be a factor).
I have also tried to explicitly load our Lesson class before the query that throws the error (via Kernel#load) and this also has no effect.
I suspect it comes down to something in lib/neo4j/active_node/labels/reloading.rb such as the WRAPPED_CLASSES, but I'm afraid I don't know how to get our classes invited to that party.
Any help or ideas would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I'm experiencing this also. One aspect to our codebase is that we define one of our neo4j models in a separate gem that we then include in our app. When the rails app first boots everything is good, then If I change any file I get this error. For example, I can add an empty line to an unrelated class, reload the page and this error appears. I tried to look into the rails autoloading system but it seems there is no easy way to log reloading errors.
neo4j gem version: 9.3.0
neo4j-core version: 8.1.4
I'm having an issue that you appear to have solved back in 2015,
here: #717
and
here: neo4jrb/devise-activegraph#16
The error only happens in development mode, and only when a change is made to files and therefore code is reloaded.
The error message, for example, is
NoMethodError - undefined method 'name' for #<Neo4j::Core::Node:0x00007f960c7bc858>
where 'name' is one of the properties on one of our nodes (note that the error can happen equally on properties or relationships):
In trying to figure out why we're having this issue, I can only surmise that it might have something to do with the fact that we are using the neo4j gem within a gem of our own (called 'bit_farm'), which is in turn required by our Rails app.
I've tried various things to attempt to address the issue, including setting up a railtie in bit_farm which calls
Neo4j::ActiveNode::Labels::Reloading.reload_models!
but this does not do anything, asNeo4j::ActiveNode::Labels::Reloading::MODELS_TO_RELOAD
appears to be an empty array at that point.FWIW this was the railtie:
I am fairly certain that the code in
neo4j/lib/neo4j/railtie.rb
is being executed before the code in our railtie (not sure if that might be a factor).I have also tried to explicitly load our Lesson class before the query that throws the error (via Kernel#load) and this also has no effect.
I suspect it comes down to something in
lib/neo4j/active_node/labels/reloading.rb
such as the WRAPPED_CLASSES, but I'm afraid I don't know how to get our classes invited to that party.Any help or ideas would be greatly appreciated.
The text was updated successfully, but these errors were encountered: