Skip to content

Instantly share code, notes, and snippets.

@pnomolos
Created December 22, 2011 21:35
Show Gist options
  • Save pnomolos/1511964 to your computer and use it in GitHub Desktop.
Save pnomolos/1511964 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'data_mapper'
::DataMapper.setup(:default,'mysql://root@127.0.0.1/test')
class CartItem
include DataMapper::Resource
belongs_to :product
property :id, Serial
end
class Product
include DataMapper::Resource
has n, :cart_items
property :id, Serial
property :deleted, ParanoidBoolean, :default => false, :lazy => false
end
DataMapper.finalize
# This will output nil if :lazy => true for the ParanoidBoolean
puts CartItem.get(3).product.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment