mongoid-simple-userstamps 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81b8a57413bd388e7166eafb49105d1ea7c7e37b7ce952e99a06532af6d41522
4
- data.tar.gz: 4e52b4597c4be8f096cb67b6f31b2c14708e5edf57ef035657d1bc20b8a7a0da
3
+ metadata.gz: fb3debfc6e1e3ff58dc489d52e8e39d1d103766f1aae5f22518d4921f59071d1
4
+ data.tar.gz: 6c9ae82db5763d527e98017773877ca4fb89e6755f4f8e305ee7a5c8b4850465
5
5
  SHA512:
6
- metadata.gz: 939f8d2fce4291e8f77823df64d19f81f238519d6b7886eabb066747d16c08f55803f9832d026de4e5744eade39d7225a86e2422d5e3f0e1f351c831da14fe3c
7
- data.tar.gz: 5401425c074473d84f67df1dcd5a38a5a529a93c537e7f65030a20706cd2eb4905764ff8789e18c9d52ec8f7445471b976bb46406157d6bdfa9fdaf80d19aad5
6
+ metadata.gz: 2efcc441865a2a86443adc6a83daeeafde70a20c8ca9a6d4bfb7807b2807b5fe3883733757a6b8f00eac36fb79d4a67d9f40c06813815d5afd3f21863e13107b
7
+ data.tar.gz: 0d9c86ec9d0933bd334051b75f4b820344f9250780cb4fa0010d9562c86caef635c161a24a4bf68415f17fd3c813ee15ba48d2000a3926aedb81f1974936ff16
data/README.md CHANGED
@@ -72,7 +72,7 @@ Or install it yourself as:
72
72
 
73
73
  ```ruby
74
74
  Warden::Manager.after_set_user do |user, auth, opts|
75
- Mongoid::Userstamps::Config.set_current(record)
75
+ Mongoid::Userstamps::User.current = record
76
76
  end
77
77
  ```
78
78
 
@@ -19,7 +19,7 @@ module Mongoid
19
19
  end
20
20
 
21
21
  before_update do
22
- self.updated_by = Mongoid::Userstamps::User.current
22
+ self.updated_by = Mongoid::Userstamps::User.current unless updated_by_id_changed?
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Userstamps
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -46,6 +46,15 @@ describe 'Mongoid::Userstamp' do
46
46
  post.save
47
47
  expect(post.updated_by).to eq(@user)
48
48
  end
49
+
50
+ it 'should not overwrite updated_by' do
51
+ user = User.create
52
+ post = Post.create
53
+ post.title = "title"
54
+ post.updated_by = user
55
+ post.save
56
+ expect(post.updated_by).to eq(user)
57
+ end
49
58
  end
50
59
 
51
60
  context 'when check thread safe' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-simple-userstamps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Jurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler