Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 06:03
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 anonymous/4441176 to your computer and use it in GitHub Desktop.
Save anonymous/4441176 to your computer and use it in GitHub Desktop.
An attempt to find a failing case with string keys.
require 'rubygems'
require 'dm-core'
require 'uuid'
require_relative 'lib/dm-redis-adapter/adapter.rb'
DataMapper.setup(:default, {:adapter => "redis"})
class Zone
include DataMapper::Resource
property :id, String, :key => true, :unique_index => true, :default => lambda { |x,y| UUID.new.generate }
property :preview_mode, Boolean, :default => false
has 1, :campaign
end
class Campaign
include DataMapper::Resource
property :id, String, :key => true, :unique_index => true, :default => lambda { |x,y| UUID.new.generate }
property :name, String
belongs_to :zone
end
DataMapper.finalize
z = Zone.create
c = Campaign.create(:name => "The light on the Bosporus", :zone => z)
puts Campaign.first.zone
puts Zone.first.campaign.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment