Skip to content

Instantly share code, notes, and snippets.

@takuyan
Created December 21, 2012 05:51
Show Gist options
  • Save takuyan/4350910 to your computer and use it in GitHub Desktop.
Save takuyan/4350910 to your computer and use it in GitHub Desktop.
# Create a root node:
science = Category.create!(name: 'Science')
# Put a new thing inside this root node:
physics = Category.create!(name: 'Physics')
physics.move_to_child_of(science)
# Put another thing inside the "physics" node:
gravity = Category.create!(name: 'Gravity')
gravity.move_to_child_of(physics)
# Reload the root node:
science.reload
# Now you should have something that resembles this:
# science
# '-- physics
# '-- gravity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment