Skip to content

Instantly share code, notes, and snippets.

@tubbo tubbo/order.rb
Last active Jan 4, 2017

Embed
What would you like to do?
class Order < ApplicationRecord
has_many :order_items, dependent: :destroy
def amount
order_items.sum :total_price
end
end
class OrderItem < ApplicationRecord
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.