public
Description: Fork of DataMapper 0.3 with patches to fix major show-stopping bugs
Clone URL: git://github.com/cardmagic/dm-works.git
Fixing has_many :things, :order => 'position' support
cardmagic (author)
Fri Apr 18 14:36:47 -0700 2008
commit  b504df86f740e885a4dca7a434faefb8e47ff863
tree    33a6214d873b51ef390d39cc510de564cfd769fa
parent  0692a24228cbc20ac92792400746f064ac4dfcbc
...
774
775
776
777
 
778
779
780
...
774
775
776
 
777
778
779
780
0
@@ -774,7 +774,7 @@ module DataMapper
0
     end
0
 
0
     def loaded_set=(value)
0
- value << self
0
+ value << self unless value.include?(self)
0
       @loaded_set = value
0
     end
0
 
...
8
9
10
11
 
12
13
14
15
16
 
17
18
19
...
8
9
10
 
11
12
13
14
15
 
16
17
18
19
0
@@ -8,12 +8,12 @@ module DataMapper
0
       
0
       def initialize(*types)
0
         @types = types
0
- @set = SortedSet.new
0
+ @set = Array.new
0
       end
0
       
0
       def <<(item)
0
         raise ArgumentError.new("#{item.inspect} must be a kind of: #{@types.inspect}") unless @types.any? { |type| type === item }
0
- @set << item
0
+ @set << item unless @set.include?(item)
0
         return self
0
       end
0
       
...
37
38
39
40
41
 
 
42
43
44
...
37
38
39
 
 
40
41
42
43
44
0
@@ -37,8 +37,8 @@ describe DataMapper::Support::TypedSet do
0
     s << 5
0
     s << 3
0
 
0
- s.entries.first.should eql(0)
0
- s.entries.last.should eql(30)
0
+ s.entries.first.should eql(8)
0
+ s.entries.last.should eql(3)
0
   end
0
 
0
   it "should respond to blank?" do

Comments

    No one has commented yet.