Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created January 22, 2010 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/284020 to your computer and use it in GitHub Desktop.
Save kylefox/284020 to your computer and use it in GitHub Desktop.
# Assume a Post belongs to a Blog.
# Django does this with one SQL statement:
posts = Post.objects.filter(blog__name="My Blog")
# Rails:
posts = Blog.find_by_name("My Blog").posts
# Rails?
posts = Post.where(:blog__name => 'My Blog')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment