Class: Integral::List
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Integral::List
- Defined in:
- app/models/integral/list.rb
Overview
Represents a generic list such as a gallery or menu
Instance Method Summary collapse
-
#dup ⇒ List
Duplicates the list including all attributes, list items and list item children.
Methods inherited from ApplicationRecord
Instance Method Details
#dup ⇒ List
Duplicates the list including all attributes, list items and list item children
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/integral/list.rb', line 36 def dup new_list = super() list_items.each do |list_item| new_list_item = list_item.dup if list_item.has_children? list_item.children.each do |child| new_list_item.children << child.dup end end new_list.list_items << new_list_item end new_list end |