Created
August 15, 2015 10:24
-
-
Save anonymous/21f6020e6085e517f159 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
# Function transfer in Account class | |
def transfer(recipient_id, amount) | |
result = @db.query("SELECT Balance FROM Balance WHERE AccountID = #{@account_id} ORDER BY Date DESC LIMIT 1") | |
if result.first['Balance'] >= amount | |
puts @db.query("CALL Transfer(#{@account_id}, #{recipient_id}, #{amount})").inspect | |
puts nil.inspect | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment