Skip to content

Commit

Permalink
Merge branch 'model_label_map_fix' into 7.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cheerfulstoic committed Aug 1, 2016
2 parents 2bbe3da + 186c1ce commit 0b364a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/neo4j/active_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def nodeify(object)
include Neo4j::Timestamps if Neo4j::Config[:record_timestamps]

def self.inherited(other)
Neo4j::ActiveNode::Labels.clear_wrapped_models

inherit_id_property(other)
attributes.each_pair do |k, v|
other.inherit_property k.to_sym, v.clone, declared_properties[k].options
Expand Down
7 changes: 1 addition & 6 deletions lib/neo4j/active_node/labels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ module Labels
MODELS_FOR_LABELS_CACHE.clear

included do |model|
def self.inherited(model)
add_wrapped_class(model)

super
end
Neo4j::ActiveNode::Labels.clear_wrapped_models

Neo4j::ActiveNode::Labels.add_wrapped_class(model) unless Neo4j::ActiveNode::Labels._wrapped_classes.include?(model)
end
Expand Down Expand Up @@ -69,7 +65,6 @@ def self.model_for_labels(labels)
end

def self.clear_wrapped_models
WRAPPED_CLASSES.clear
MODELS_FOR_LABELS_CACHE.clear
Neo4j::Node::Wrapper::CONSTANTS_FOR_LABELS_CACHE.clear
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def expect_queries(count)
Dir["#{File.dirname(__FILE__)}/shared_examples/**/*.rb"].each { |f| require f }

def clear_model_memory_caches
Neo4j::ActiveNode::Labels::WRAPPED_CLASSES.clear
Neo4j::ActiveNode::Labels.clear_wrapped_models
end

Expand Down

0 comments on commit 0b364a0

Please sign in to comment.