Skip to content

Instantly share code, notes, and snippets.

@DCarper
Created March 7, 2011 19:24
Show Gist options
  • Select an option

  • Save DCarper/859031 to your computer and use it in GitHub Desktop.

Select an option

Save DCarper/859031 to your computer and use it in GitHub Desktop.
# i need the 5 most recent guesses
# option1 - scope on guesses
@bracket.guesses.most_recent(5)
# option2 - relationship that overlaps with bracket has_many :guesses
@bracket.five_most_recent_guesses
#option3 - an explicit method on the bracket instance
@bracket.five_most_recent_guesses which just runs it's own hard coded query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment