Skip to content

Instantly share code, notes, and snippets.

@proton
Created August 7, 2012 20:56
Embed
What would you like to do?
class Order
include Mongoid::Document
embeds_one :cart
end
class Cart
include Mongoid::Document
embedded_in :order
embeds_many :cart_items
end
class CartItem
include Mongoid::Document
embedded_in :cart
field :title, :type => String
end
class OrderAuditObserver < Mongoid::Observer
observe :order
def around_update(resourse)
changes = resourse.changes.clone
yield
#case resourse.class
#when Order
#end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment