mm_uses_uuid 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module MmUsesUuid
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/mm_uses_uuid.rb CHANGED
@@ -41,7 +41,7 @@ module MmUsesUuid
41
41
  end
42
42
 
43
43
  def new(params = {})
44
- passed_id = params.delete(:id) || params.delete(:_id)
44
+ passed_id = params.delete(:id) || params.delete(:_id) || params.delete('id') || params.delete('_id')
45
45
  new_object = super(params)
46
46
  if passed_id.is_a?(BSON::Binary) and passed_id.subtype == BSON::Binary::SUBTYPE_UUID
47
47
  new_object.id = passed_id
@@ -46,7 +46,10 @@ describe MmUsesUuid do
46
46
  end
47
47
 
48
48
  it "should not set a new uuid if one as passed as a param" do
49
- group_with_passed_id = Group.new(:_id => BSON::Binary.new("3333333333334333y333333333333333", BSON::Binary::SUBTYPE_UUID))
49
+ group_with_passed_id = Group.new(:id => BSON::Binary.new("3333333333334333y333333333333333", BSON::Binary::SUBTYPE_UUID))
50
+ group_with_passed_id.id.to_s.should == "3333333333334333y333333333333333"
51
+
52
+ group_with_passed_id = Group.new('_id' => BSON::Binary.new("3333333333334333y333333333333333", BSON::Binary::SUBTYPE_UUID))
50
53
  group_with_passed_id.id.to_s.should == "3333333333334333y333333333333333"
51
54
  end
52
55
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Chambers
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-12-11 00:00:00 +00:00
17
+ date: 2011-12-13 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency