Created
January 22, 2009 21:58
-
-
Save edavis10/50744 to your computer and use it in GitHub Desktop.
This file contains 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
# My jQuery thinking is starting to bleed into Ruby | |
def amount_for_user(user=nil) | |
return 0 if self.time_entries.size <= 0 | |
return self.time_entries.select do |time_entry| | |
user.nil? || time_entry.user == user | |
end.collect(&:cost).compact.sum | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment