Created
April 30, 2009 19:12
-
-
Save mbleigh/104625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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