Last active
June 25, 2017 16:11
-
-
Save mariorcardoso/e1241b6f154d22ff6f7b0054da5e69f9 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 Product < ActiveRecord::Base | |
def cost | |
Money.new(cents, currency) | |
end | |
def cost=(cost) | |
self.cents = cost.cents | |
self.currency = cost.currency.to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment