Created
December 22, 2011 21:35
-
-
Save pnomolos/1511964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'data_mapper' | |
::DataMapper.setup(:default,'mysql://[email protected]/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