active_record_survey 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9764b3647e3386e4d60b9753940515b78881b88
4
- data.tar.gz: 899bf6944ac349d04d2aca7b20254837a2a93bd2
3
+ metadata.gz: 2236594b733ee3733cb90bec502c89547d8ff779
4
+ data.tar.gz: 72f6a3a843a736f2a78fa6625932acedbf2d05f9
5
5
  SHA512:
6
- metadata.gz: 765649c5e0aa37a8b02fac5ef171852d45f4a5145ea414f1486a4fa73f3b95834bee2f68192145681bd3975cba6e1b580eb09d959e139a9c59ea95f2b1d46402
7
- data.tar.gz: b23afb8a510de738c55fd823fdc03d498471b4e4c65e4b3eca5a9ff7a919a5359e066b8e0ea782b4adeddbb28083f33c8310d034f24e6d73c4dd9377752e9a26
6
+ metadata.gz: 77f3b496b4bfaaee2ffc278e1eac69290b7912c517a0eaa4dfd9acdadac162396e477fa7066db0b2ba43b2cd17a479bfa145cac38a1b18b0586a9c25e352ee51
7
+ data.tar.gz: dfc42d1aa7e04ab2fd8c714f7405ca1c5fddc0c7109d1bf7319518084ee47790111d5461521a10edb75c0d9b74bb07021af5721a193c4bda480eb21df6ad6ba8
@@ -10,7 +10,7 @@ module ActiveRecordSurvey
10
10
  # Recursively creates a copy of this entire node_map
11
11
  def recursive_clone
12
12
  node_map = self.survey.node_maps.build(:survey => self.survey, :node => self.node)
13
- self.children.each { |child_node|
13
+ self.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |child_node|
14
14
  child_node.survey = self.survey # required due to voodoo - we want to use the same survey with the same object_id
15
15
  node_map.children << child_node.recursive_clone
16
16
  }
@@ -50,13 +50,13 @@ module ActiveRecordSurvey
50
50
 
51
51
  # Check to see whether there is an infinite loop from this node_map
52
52
  def has_infinite_loop?(path = [])
53
- self.children.each { |i|
53
+ self.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |i|
54
54
  # Detect infinite loop
55
55
  if path.include?(self.node) || i.has_infinite_loop?(path.clone.push(self.node))
56
56
  return true
57
57
  end
58
58
  }
59
- false
59
+ path.include?(self.node)
60
60
  end
61
61
 
62
62
  def mark_self_and_children_for_destruction
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordSurvey
2
- VERSION = "0.1.26"
2
+ VERSION = "0.1.27"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_survey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord