mongoid_auto_increment_id 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -8,7 +8,10 @@ Idea from MongoDB document: [How to Make an Auto Incrementing Field](http://www.
8
8
 
9
9
  ## Installation
10
10
 
11
- gem 'mongoid_auto_increment_id'
11
+ # for Mongoid 2.2.x
12
+ gem 'mongoid_auto_increment_id', "0.2.2"
13
+ # for Mongoid 2.3.x
14
+ gem 'mongoid_auto_increment_id', "0.3.1"
12
15
 
13
16
 
14
17
  ## REQUIREMENTS
@@ -50,6 +50,7 @@ module Mongoid
50
50
  # Override Mongoid::Extensions::ObjectId::Conversions.convert for covert id to Integer type.
51
51
  module Conversions
52
52
  def convert(klass, args, reject_blank = true)
53
+
53
54
  case args
54
55
  when ::Array
55
56
  args.delete_if { |arg| arg.blank? } if reject_blank
@@ -57,6 +58,10 @@ module Mongoid
57
58
  when ::Hash
58
59
  args.tap do |hash|
59
60
  hash.each_pair do |key, value|
61
+ # TODO: this code it not good
62
+ if key.to_s == "_id" and value.class == "".class
63
+ value = value.to_i
64
+ end
60
65
  hash[key] = value
61
66
  end
62
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_auto_increment_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-06 00:00:00.000000000Z
12
+ date: 2011-12-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
16
- requirement: &70101329139860 !ruby/object:Gem::Requirement
16
+ requirement: &70339195789380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.2.0
21
+ version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70101329139860
24
+ version_requirements: *70339195789380
25
25
  description: This gem for change Mongoid id field as Integer like MySQL.
26
26
  email:
27
27
  - huacnlee@gmail.com