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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99ca65394dfce3f1dd3e17d7b8ed228c3794ddb4
4
- data.tar.gz: 2794ed3480d4b5f31dac6d0d0dc0f0597ac71877
3
+ metadata.gz: b392355135b13b4df763c2abc659d165e20b6e45
4
+ data.tar.gz: 2c18a08fed97bde7a943dd69c17c8a627b3ef459
5
5
  SHA512:
6
- metadata.gz: 7deaf20f19f602726f704ce2ce3aee04961b32cd9b76db9e2c2ed1d7d9eceea20901b82c5fedd9339d3324a65ea8773c983c19e34db06c3e18a2e463c20cb0a8
7
- data.tar.gz: bd2e858515a2f21c68a73cbcc64eee28f6192b170de9005dc9f7a36b1497b09b92f8ebd037c87dd8bd3c782632f9d5f3c2e4f45ee3f5769daecb5f1590a5bee0
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
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Observers
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
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
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-06-20 00:00:00.000000000 Z
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.12
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