Class: ActiveRecordSurvey::Survey
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActiveRecordSurvey::Survey
- Defined in:
- lib/active_record_survey/survey.rb
Instance Method Summary collapse
Instance Method Details
#as_map(*args) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/active_record_survey/survey.rb', line 12 def as_map(*args) = args. [:node_maps] ||= self.node_maps self.node_maps.select { |i| !i.parent && !i.marked_for_destruction? }.collect { |i| i.as_map() } end |
#root_node ⇒ Object
8 9 10 |
# File 'lib/active_record_survey/survey.rb', line 8 def root_node self.node_maps.includes(:node).select { |i| i.depth === 0 }.first end |