Skip to content

Instantly share code, notes, and snippets.

@mmaa
Created November 5, 2010 03:22
Show Gist options
  • Select an option

  • Save mmaa/663602 to your computer and use it in GitHub Desktop.

Select an option

Save mmaa/663602 to your computer and use it in GitHub Desktop.
envelope balance
envelope_balance =
EnvelopeTransaction.where(
:destination => [self]).sum(:amount) -
EnvelopeTransaction.where(
:source_type => envelope,
:source_id => [self]).sum(:amount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment