Created
August 8, 2008 16:08
-
-
Save teamon/4578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def full_path_data_with_children | |
(self.ancestors << self).map { |e| | |
pid = e.id == 1 ? 0 : e.id | |
{ :id => pid, :data => e.children.sort.map { |i| { :id => i.id, :name => i.name, :parent_id => pid } } } | |
}.flatten | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment