Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created April 30, 2009 19:12
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 mbleigh/104625 to your computer and use it in GitHub Desktop.
Save mbleigh/104625 to your computer and use it in GitHub Desktop.
# Let's say we have this:
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :user
end
# How do I do these:
# 1) Find only users who have at least one post
# 2) List users in order of most posts to least posts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment