Skip to content

Instantly share code, notes, and snippets.

@redsquirrel
Created September 11, 2008 16:36
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 redsquirrel/10252 to your computer and use it in GitHub Desktop.
Save redsquirrel/10252 to your computer and use it in GitHub Desktop.
# Bad old stuff
class KDOrders < ActiveRecord::Base
belongs_2 :cart
end
class Cart < ActiveRecord::Base
set_primary_key "cart_id"
can_haz :cart_items
end
class CartItem < ActiveRecord::Base
set_primary_key "cart_item_id"
has_wan :kd_order_item, :class_name => "KDOrderItem"
end
class KDOrderItem < ActiveRecord::Base
end
# New hotness
class KDCart < ActiveRecord::Base set_primary_key "cart_id" can_haz :kd_cart_items, :class_name => "KDCartItem", :foreign_key => "cart_id"
end
class KDCartItem < ActiveRecord::Base
set_primary_key "cart_item_id"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment