You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
Hopefully the ticket title explains the problem well enough, I'm too tired to go into prose...
This came about with integers, as we were trying to re-implement a simple for of is-list. But I've written an example from scratch to illustrate the problem:
require'rubygems'require'dm-core'require'dm-validations'require'spec'SQLITE_FILE=File.join(`pwd`.chomp,"test.db")DataMapper.setup(:default,"sqlite3:#{SQLITE_FILE}")DataMapper.setup(:reloaded,"sqlite3:#{SQLITE_FILE}")classFarmincludeDataMapper::Resourceproperty:id,Serialhasn,:cows,:order=>[:cow_id]endclassCowincludeDataMapper::Resourceproperty:id,Serialproperty:cow_id,Integerproperty:name,String# Comment out the following line to make the spec passvalidates_is_unique:name,:scope=>[:farm]belongs_to:farmendmoduleIdentityMapHelperdefwith_db_reconnect(&blk)original_repository=DataMapper::Repository.context.poprepository(:reloaded, &blk)DataMapper::Repository.context << original_repositoryendendSpec::Runner.configuredo |config|
includeIdentityMapHelperconfig.before(:each)doFarm.auto_migrate!Cow.auto_migrate!endconfig.before(:each)doDataMapper::Repository.context << repository(:default)endconfig.after(:each)doDataMapper::Repository.context.popendenddescribe"Renaming a cow"dobefore(:each)do@bluebell_farm=Farm.create!@cow_1=Cow.create(:cow_id=>1,:name=>"Daisy")@cow_2=Cow.create(:cow_id=>1,:name=>"Florence")@cow_3=Cow.create(:cow_id=>1,:name=>"Tastyburger")@bluebell_farm.cows << @cow_1 << @cow_2 << @cow_3@bluebell_farm.saveendit"should let you rename the cows"do@cow_1.name="Florence"@cow_2.name="Daisy"@bluebell_farm.savewith_db_reconnectdobluebell_farm_reloaded=Farm.get(@bluebell_farm.id)cow_1_reloaded=bluebell_farm_reloaded.cows[0]cow_2_reloaded=bluebell_farm_reloaded.cows[1]cow_1_reloaded.name.should == "Florence"cow_2_reloaded.name.should == "Daisy"endendend
Hopefully the ticket title explains the problem well enough, I'm too tired to go into prose...
This came about with integers, as we were trying to re-implement a simple for of is-list. But I've written an example from scratch to illustrate the problem:
Created by Ashley Moran - 2009-06-30 20:08:34 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/936