Module: Customize::Inherited::ClassMethods
- Defined in:
- lib/customize/inherited.rb
Instance Method Summary collapse
Instance Method Details
#root ⇒ Object
45 46 47 |
# File 'lib/customize/inherited.rb', line 45 def root joins(:inherit_node).where("parent_id is null") end |
#type_tree ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/customize/inherited.rb', line 49 def type_tree roots = root converter = proc {|items| out = items.collect { |item| {:id=>item.id,:label=>item.label,:inherit_node_id=>item.inherit_node.id, :children=>converter.call(item.children)} } } converter.call(roots) end |