Last active
January 4, 2017 21:25
-
-
Save tubbo/c48c39511e2931031e1c3b1a0d9f236b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Order < ApplicationRecord | |
has_many :order_items, dependent: :destroy | |
def amount | |
order_items.sum :total_price | |
end | |
end |
This file contains hidden or 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 OrderItem < ApplicationRecord | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment