Skip to content

Instantly share code, notes, and snippets.

@proton
Created August 7, 2012 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proton/1eb1c776d63a435778de to your computer and use it in GitHub Desktop.
Save proton/1eb1c776d63a435778de to your computer and use it in GitHub Desktop.
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