From 3597616f806e0496832922fa2c99fe2bd7d7291d Mon Sep 17 00:00:00 2001 From: Esteban Arango Medina Date: Wed, 16 Dec 2015 09:48:58 -0500 Subject: [PATCH] Fix #2 --- lib/acts_as_inheritable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/acts_as_inheritable.rb b/lib/acts_as_inheritable.rb index b700a10..41bbde4 100644 --- a/lib/acts_as_inheritable.rb +++ b/lib/acts_as_inheritable.rb @@ -20,8 +20,8 @@ def has_parent? # relations defined on `INHERITABLE_ASSOCIATIONS`. For each instance on # each relation it re-creates it. def inherit_relations(model_parent = send(:parent), current = self) - if model_parent && model_parent.class.method_defined?(:inheritable_configuration) && model_parent.class.inheritable_configuration[:associations] - model_parent.class.inheritable_configuration[:associations].each do |relation| + if model_parent && current.class.method_defined?(:inheritable_configuration) && current.class.inheritable_configuration[:associations] + current.class.inheritable_configuration[:associations].each do |relation| parent_relation = model_parent.send(relation) relation_instances = parent_relation.respond_to?(:each) ? parent_relation : [parent_relation].compact relation_instances.each do |relation_instance|