Module: Amalgam::Models::ChildrenExtension
- Defined in:
- lib/amalgam/models/hierarchical.rb
Instance Method Summary collapse
Instance Method Details
#[](slug) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/amalgam/models/hierarchical.rb', line 58 def [](slug) return @children_hash[slug] if @children_hash @children_hash = HashWithIndifferentAccess.new each_with_index do |c,i| @children_hash[i] = c if c.slug.present? @children_hash[c.slug] = c end end @children_hash[slug] end |