Created
August 23, 2019 10:52
-
-
Save KelseyDH/9e5c7cf6247683ce536242b4c4e83245 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 User < ApplicationRecord | |
def savings_account | |
self.accounts.where(savings: true).first || NullAccount.new | |
end | |
def chequing_account | |
self.accounts.where(chequing: true).first || NullAccount.new | |
end | |
def investment_account | |
self.accounts.where(investment: true).first || NullAccount.new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment