Created
September 5, 2016 13:16
-
-
Save dereknguyen269/2dcbd623f46c2bbf62ab916b3794d073 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
#account.balance = 100 | |
account = Account.find_by_user_id(5) | |
#item.price is 50 | |
if account.balance >= item.price | |
#it's good, allow user to buy this item | |
account.balance = account.balance - item.price | |
#account.balance is now 50 | |
account.save | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment