active_record_survey 0.1.47 → 0.1.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_survey/survey.rb +2 -0
- data/lib/active_record_survey/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e80f1e61c2033324b9ff86b0baa996510fd715ca
|
4
|
+
data.tar.gz: c54065cd9fd75047dde99475e0c8ecfceaed3869
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 604a6b7d809abc8e93e999c3f406768d9e09826893a7a4b02d4f4ace3300d09124c31720e107b53d9553a9f2cab3ef1b70ddf811fb6123ece5370703d2b3b82e
|
7
|
+
data.tar.gz: a7cff9333be14be320b779101a68b0acdcf26c968740aa50719120702c9249cefbf1077f898d5df9a2949a3a5ce2cdc4e0d523d99d962b902fea5d4dd56cf197
|
@@ -5,6 +5,8 @@ module ActiveRecordSurvey
|
|
5
5
|
has_many :nodes, :class_name => "ActiveRecordSurvey::Node", :foreign_key => :active_record_survey_id
|
6
6
|
has_many :questions, :class_name => "ActiveRecordSurvey::Node::Question", :foreign_key => :active_record_survey_id
|
7
7
|
|
8
|
+
default_scope { includes(node_maps:[:node,parent:[:node]]) }
|
9
|
+
|
8
10
|
def root_node
|
9
11
|
self.node_maps.includes(:node).select { |i| i.depth === 0 }.first
|
10
12
|
end
|