rails-observers 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails/observers/railtie.rb +14 -0
- data/lib/rails/observers/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b392355135b13b4df763c2abc659d165e20b6e45
|
4
|
+
data.tar.gz: 2c18a08fed97bde7a943dd69c17c8a627b3ef459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b724b5ac60c875bece3c11557d5f33c166307184ce3bfd4dde182eea4d22cef0b69db6847db9e0d884a7a37a551b302570ca4f1e2dad403d956f8ddac1f8d3a3
|
7
|
+
data.tar.gz: 1b62e5a3d11ee66f5fa4e1c4fe0e40ce25a6779c538e0d32151933cb7b8a7d5527994d08a444acc0b9a4c5bc8ee8761992a7554fd6d340060900528d19283d07
|
@@ -26,7 +26,21 @@ module Rails
|
|
26
26
|
end
|
27
27
|
|
28
28
|
config.after_initialize do |app|
|
29
|
+
begin
|
30
|
+
# Eager load `ActiveRecord::Base` to avoid circular references when
|
31
|
+
# loading a constant for the first time.
|
32
|
+
#
|
33
|
+
# E.g. loading a `User` model that references `ActiveRecord::Base`
|
34
|
+
# which calls `instantiate_observers` to instantiate a `UserObserver`
|
35
|
+
# which eventually calls `observed_class` thus constantizing `"User"`,
|
36
|
+
# the class we're loading. 💣💥
|
37
|
+
require "active_record/base"
|
38
|
+
rescue LoadError
|
39
|
+
end
|
40
|
+
|
29
41
|
ActiveSupport.on_load(:active_record) do
|
42
|
+
ActiveRecord::Base.instantiate_observers
|
43
|
+
|
30
44
|
# Rails 5.1 forward-compat. AD::R is deprecated to AS::R in Rails 5.
|
31
45
|
reloader = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader
|
32
46
|
reloader.to_prepare do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-observers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Mendonça França
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.6.
|
176
|
+
rubygems_version: 2.6.11
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: ActiveModel::Observer, ActiveRecord::Observer and ActionController::Caching::Sweeper
|