Skip to content

Instantly share code, notes, and snippets.

@jarib
Created September 23, 2009 17:09
Show Gist options
  • Save jarib/192117 to your computer and use it in GitHub Desktop.
Save jarib/192117 to your computer and use it in GitHub Desktop.
def build_tree(groups)
groups.map do |g|
{
:id => g.id,
:text => g.name,
:children => g.tags.map { |t| {:id => t.id, :text => t.name }}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment