-
-
Save jccarbonfive/4314996 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
class Loan < ActiveRecord::Base | |
def self.pending | |
where state: 'pending' | |
end | |
def self.delinquent | |
where('expires_on < ?', Time.zone.today) | |
.where('repaid = ?', false) | |
end | |
end |
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
module Lender | |
def self.pending | |
Loan | |
.where state: 'pending' | |
end | |
def self.delinquent | |
Loan | |
.where('expires_on < ?', Time.zone.today) | |
.where('repaid = ?', false) | |
end | |
end |
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
class Account < ActiveRecord::Base | |
def self.overdrawn | |
where 'balance < ?', 0 | |
end | |
end |
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
module Bank | |
def self.overdrawn | |
Account | |
.where 'balance < ?', 0 | |
end | |
end |
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
class PhoneCall < ActiveRecord::Base | |
def self.since(date) | |
where 'created_at > ?', date | |
end | |
end |
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
module TelephonyProvider | |
def self.call_history_since(date) | |
PhoneCall | |
.where 'created_at > ?', date | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment