active_record_survey 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/active_record_survey/node/answer.rb +17 -0
- data/lib/active_record_survey/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 035843adb04a8500212d2192370393bfc3fc66aa
|
4
|
+
data.tar.gz: f8694ba634658681e9360c85dd49a4ad82718ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 412ab7b79cd1a135626054fb2071eb20f710c1cda9761176271e0c6d030a3c408b03b9129a923e322d327eeb6b5670b9f6b18cd53931e02f18ab07c016a6e48c
|
7
|
+
data.tar.gz: deeb940e3e77c972ef800d4541a9f75781da2ae9b1b040237e9a774921eaa127ff44576346c7638882aa5b9c5d9771aaa438013b9afa1cd258265fcb5cf9aa20
|
data/README.md
CHANGED
@@ -9,6 +9,23 @@ module ActiveRecordSurvey
|
|
9
9
|
}.include?(false)
|
10
10
|
end
|
11
11
|
|
12
|
+
# Returns the question to the answer
|
13
|
+
def question
|
14
|
+
self.node_maps.collect { |node_map|
|
15
|
+
if node_map.parent && node_map.parent.node
|
16
|
+
# Question is not the next parent - recurse!
|
17
|
+
if node_map.parent.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer)
|
18
|
+
node_map.parent.node.question
|
19
|
+
else
|
20
|
+
node_map.parent.node
|
21
|
+
end
|
22
|
+
# Root already
|
23
|
+
else
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
}.first
|
27
|
+
end
|
28
|
+
|
12
29
|
# Removes the link
|
13
30
|
# TODO - does this work when saved??
|
14
31
|
def remove_link
|
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.
|
4
|
+
version: 0.1.16
|
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-
|
11
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|