So, I have this data structure:
+[#<Folder id: 1, name: "mollitia", parent_id: nil, user_id: 1, created_at: "2014-06-27 16:00:59", updated_at: "2014-06-27 16:00:59">,
+ #<Folder id: 2, name: "porro", parent_id: 1, user_id: 1, created_at: "2014-06-27 16:00:59", updated_at: "2014-06-27 16:00:59">,
+ #<Folder id: 3, name: "omnis", parent_id: 2, user_id: 1, created_at: "2014-06-27 16:00:59", updated_at: "2014-06-27 16:00:59">]
who comes back self.ancestors
can I rip off his names?
def pwd
self.ancestors.pluck(:name)
end
Above results in
undefined method `pluck' for #<Array:0x007ff4da780290>
Update
Awesome Printing Structure:
[
[0]
:id => 3,
:name => "blanditiis",
:parent_id => 2,
:user_id => 1,
:created_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00,
:updated_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00
},
[1]
:id => 2,
:name => "neque",
:parent_id => 1,
:user_id => 1,
:created_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00,
:updated_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00
},
[2]
:id => 1,
:name => "ut",
:parent_id => nil,
:user_id => 1,
:created_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00,
:updated_at => Fri, 27 Jun 2014 18:04:02 UTC +00:00
}
]