64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/puffer/resource.rb', line 64
def children
@children ||= resource_node.children.map do |child_node|
child_params = ActiveSupport::HashWithIndifferentAccess.new({:puffer => child_node})
resource_node.ancestors.each do |ancestor|
key = ancestor.to_s.singularize.foreign_key
child_params[key] = params[key] if params[key]
end
key = resource_node.to_s.singularize.foreign_key
child_params[key] = params[:id] if params[:id]
self.class.new child_params, controller_instance
end
end
|