Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
Created March 14, 2011 01:39
Show Gist options
  • Select an option

  • Save linusthe3rd/868645 to your computer and use it in GitHub Desktop.

Select an option

Save linusthe3rd/868645 to your computer and use it in GitHub Desktop.
named scopes I am using
scope :open, lambda {
joins(:program_populations).
where('program_populations.current_population < program_populations.max_population').
group("programs.id")
}
scope :closed, lambda {
joins(:program_populations).
where('program_populations.current_population >= program_populations.max_population').
group("programs.id")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment