activerecord-autoscope 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ebf49c0e9411d8e3276fc893fe9ed8719f6ab1acda91d63657008799be67dd7
|
4
|
+
data.tar.gz: 937fe74e98aa59b7e048dde8df4dedcf66c8f713f460ef9750c092b1bb997397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805a2109457614814a9e7740a521b67fd8c6dd0515329fdfc850849611575763655e892013538496805eaa7e6efe851ca052949123edc987132649c52cb0fe02
|
7
|
+
data.tar.gz: 9bee74f15a103f81c766e7a87e8d90982ca317e7eb890c4ab502a909268aefbc2aa0f318192971bc1efab07ff1a31088a2af111a48d36e0809b33025fb78aebc
|
data/Gemfile.lock
CHANGED
@@ -15,6 +15,14 @@ end
|
|
15
15
|
|
16
16
|
module ActiveRecord
|
17
17
|
module AutoScope # :nodoc:
|
18
|
+
def self.tracer
|
19
|
+
@tracer ||= TracePoint.trace(:end) do |event|
|
20
|
+
next unless event.self.respond_to?(:enable_auto_scopes!)
|
21
|
+
|
22
|
+
event.self.enable_auto_scopes!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
def self.configure
|
19
27
|
yield config
|
20
28
|
end
|
@@ -3,18 +3,19 @@
|
|
3
3
|
module ActiveRecord
|
4
4
|
module AutoScope
|
5
5
|
class Railtie < ::Rails::Railtie # :nodoc:
|
6
|
-
config.
|
6
|
+
config.before_initialize do
|
7
7
|
ActiveSupport.on_load :active_record do
|
8
8
|
ActiveRecord::Base.extend ::ActiveRecord::AutoScope::ScopeMethods
|
9
9
|
end
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
config.to_prepare do
|
13
|
+
::ActiveRecord::AutoScope.tracer.enable if ::ActiveRecord::AutoScope.config.auto_define_scopes
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
# TODO: Disable trace point on development and test
|
17
|
+
config.after_initialize do
|
18
|
+
::ActiveRecord::AutoScope.tracer.disable if ::ActiveRecord::AutoScope.config.auto_define_scopes && ::Rails.application.config.eager_load
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-autoscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Hirano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|