Created
January 6, 2009 22:16
-
-
Save hexorx/44045 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
def self.previous_cycle user, cycle = nil | |
cycle ||= Date.today | |
previous_cycle = find(:first, :select => 'distinct billed', :conditions => ['user_id = ? AND billed < ?', user, cycle], :order => 'billed DESC') | |
previous_cycle ? previous_cycle.billed : nil | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment