Skip to content

Instantly share code, notes, and snippets.

@otkrsk
Created November 18, 2012 02:58
Show Gist options
  • Save otkrsk/4103164 to your computer and use it in GitHub Desktop.
Save otkrsk/4103164 to your computer and use it in GitHub Desktop.
Rails Console
# Find an object in the console
User.where("query = ?", condition)
# Find an attribute in the model (if it is an array)
u.first.attribute
# Destroy an object that has association. Better than delete.
object.destroy
# Pretty output
YAML::ENGINE.yamler = 'syck'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment