paresseux 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module Mongoid
6
6
  extend ::ActiveSupport::Concern
7
7
 
8
8
  included do
9
- field :paresseux_version, type: Integer, default: self::VERSION
9
+ field :paresseux_version, type: Integer
10
10
  after_initialize :paresseux_migrate
11
11
  before_save :set_paresseux_version
12
12
  end
@@ -14,8 +14,11 @@ module Mongoid
14
14
  private
15
15
 
16
16
  def paresseux_migrate
17
- if paresseux_version < current_paresseux_version
18
- "#{self.class}Paresseux".constantize.new(self, current_paresseux_version).migrate!
17
+ unless new_record?
18
+ self.paresseux_version ||= 1
19
+ if paresseux_version < current_paresseux_version
20
+ "#{self.class}Paresseux".constantize.new(self, current_paresseux_version).migrate!
21
+ end
19
22
  end
20
23
  end
21
24
 
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module Paresseux
2
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
3
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paresseux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &21025140 !ruby/object:Gem::Requirement
16
+ requirement: &23483200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.8'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *21025140
24
+ version_requirements: *23483200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &21024640 !ruby/object:Gem::Requirement
27
+ requirement: &23482720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.2'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *21024640
35
+ version_requirements: *23482720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mongoid
38
- requirement: &21024180 !ruby/object:Gem::Requirement
38
+ requirement: &23482260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.4'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *21024180
46
+ version_requirements: *23482260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bson_ext
49
- requirement: &21023720 !ruby/object:Gem::Requirement
49
+ requirement: &23481800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '1.5'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *21023720
57
+ version_requirements: *23481800
58
58
  description: Lazy migration tool for active model aware model.
59
59
  email: jboyer@af83.com
60
60
  executables: []