glebtv_mongoid_userstamp 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/mongoid/userstamp/railtie.rb +0 -1
- data/lib/mongoid/userstamp/user.rb +3 -4
- data/lib/mongoid/userstamp/version.rb +1 -2
- data/lib/mongoid_userstamp.rb +1 -1
- data/mongoid_mongoid_userstamp.gemspec +3 -3
- data/spec/spec_helper.rb +4 -1
- metadata +9 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55079fcbd77aab8476f83b7654921bad08903784
|
4
|
+
data.tar.gz: 40555a940d9e3a7052ba03311a46ea317e3c16a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24923c2a3ffb33311088b33d50292e57c8544788dd446d9c46d9fcb85604482dd4c46bbdfb1ab9205a9dbc5804f22fb26de8c3174c184dadae42752926c95597
|
7
|
+
data.tar.gz: 017c16403ead16aa0595c3d04a783718bacf80c27e5f704da73f27aeec049375f84bfdb7a3ee49d2a3a4b40fe9eaf6d083a521458c8fb96a7488e7a86086f2cb
|
data/README.md
CHANGED
@@ -5,6 +5,10 @@ This fork is INCOMPATIBLE with upstream due to different default field names
|
|
5
5
|
This fork uses actual mongoid belongs_to relations instead of low level work with BSON fields. Primary reason for doing
|
6
6
|
this is to support eager loading for creator/updater relation.
|
7
7
|
|
8
|
+
Also, this gem uses [RequestStore](https://github.com/steveklabnik/request_store) instead of a thread local variable.
|
9
|
+
|
10
|
+
Current user is availiable to you any time via ```RequestStore.store[:user]```
|
11
|
+
|
8
12
|
MongoidUserstamp adds stamp columns for created by and updated by information within Rails applications using Mongoid ODM.
|
9
13
|
|
10
14
|
## Version Support
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Mongoid
|
3
2
|
module Userstamp
|
4
3
|
module User
|
@@ -6,17 +5,17 @@ module Mongoid
|
|
6
5
|
|
7
6
|
included do
|
8
7
|
def current?
|
9
|
-
!
|
8
|
+
!RequestStore.store[:user].nil? && self._id == RequestStore.store[:user]._id
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
13
12
|
module ClassMethods
|
14
13
|
def current
|
15
|
-
|
14
|
+
RequestStore.store[:user]
|
16
15
|
end
|
17
16
|
|
18
17
|
def current=(value)
|
19
|
-
|
18
|
+
RequestStore.store[:user] = value
|
20
19
|
end
|
21
20
|
|
22
21
|
def do_as(user, &block)
|
data/lib/mongoid_userstamp.rb
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.post_install_message = File.read('UPGRADING') if File.exists?('UPGRADING')
|
20
20
|
|
21
|
-
s.add_runtime_dependency 'mongoid', '~> 4.0.
|
21
|
+
s.add_runtime_dependency 'mongoid', '~> 4.0.2'
|
22
|
+
s.add_runtime_dependency 'request_store'
|
23
|
+
|
22
24
|
s.add_development_dependency 'rake'
|
23
25
|
s.add_development_dependency 'rspec'
|
24
|
-
s.add_development_dependency 'yard'
|
25
|
-
s.add_development_dependency 'gem-release'
|
26
26
|
end
|
27
27
|
|
data/spec/spec_helper.rb
CHANGED
@@ -13,7 +13,10 @@ Mongoid.configure do |config|
|
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
begin
|
17
|
+
Object.send :remove_const, :Config
|
18
|
+
rescue Exception => e
|
19
|
+
end
|
17
20
|
Config = RbConfig
|
18
21
|
|
19
22
|
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glebtv_mongoid_userstamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GlebTv
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mongoid
|
@@ -18,36 +18,22 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.0.
|
21
|
+
version: 4.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 4.0.
|
28
|
+
version: 4.0.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: request_store
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
|
-
type: :
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: rspec
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
type: :development
|
36
|
+
type: :runtime
|
51
37
|
prerelease: false
|
52
38
|
version_requirements: !ruby/object:Gem::Requirement
|
53
39
|
requirements:
|
@@ -55,7 +41,7 @@ dependencies:
|
|
55
41
|
- !ruby/object:Gem::Version
|
56
42
|
version: '0'
|
57
43
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
44
|
+
name: rake
|
59
45
|
requirement: !ruby/object:Gem::Requirement
|
60
46
|
requirements:
|
61
47
|
- - ">="
|
@@ -69,7 +55,7 @@ dependencies:
|
|
69
55
|
- !ruby/object:Gem::Version
|
70
56
|
version: '0'
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
58
|
+
name: rspec
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
74
60
|
requirements:
|
75
61
|
- - ">="
|
@@ -128,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
114
|
version: '0'
|
129
115
|
requirements: []
|
130
116
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.4.5
|
132
118
|
signing_key:
|
133
119
|
specification_version: 4
|
134
120
|
summary: Userstamp for Mongoid
|
@@ -137,4 +123,3 @@ test_files:
|
|
137
123
|
- spec/spec_helper.rb
|
138
124
|
- spec/support/book.rb
|
139
125
|
- spec/support/user.rb
|
140
|
-
has_rdoc:
|