- Implement
#instantiate_observers
- New structure to replace ObserverArray
- Each ORM (i.e.
ActiveRecord::Base
) will have a class method#pending_observees
returning a array of all fully-qualified model names (as strings) to begin observing upon inheritance. - Each ORM observer class (i.e.
ActiveRecord::Observer
) will have a class method (#descendant_instances
) returning an array of all observers (objects). - Each observer will have an
#current_observees
class method which will return an array (of strings) the models the observer observes. - Each model will have an
#observers
class method which will obtain an array of observer objects observing the model.
- Each ORM (i.e.
- Only strings can be 'observed'. (Anything that responds to #to_s is converted. Warnings are raised for Classes.)
- Upon setting up observers, instantiate them, but don't rush to load the classes they observe. instead, hook into those by monitoring the inherit callbacks of
Active*::Base
- This means observers specify their classes with symbols or strings. NOT constants.
- ObserverArray should only store Observer instances. No need to store observer classes at all. (Can create a delegator to helpful methods in the class.)
- Probably a better idea to change functionality since this is a major version change rather than have deprecators strewn all over the place.
- I have a strong bias for
prepend
nowadays. Check to see if when I useprepend
it's really preferable overinclude
/extend
. - Document all changes (especially backward-incompatible ones).
- Make sure documentation is pretty and where it belongs.
- Optimize autoloading, etc. (Perhaps last?)
- Writeup upgrade instructions (noting backwards-incompatible changes).
- Perhaps write an upgrade generator(?)
- Cause deprecator to raise errors in testing mode. (Fix/complete it in general)
- Confirm bootstrapper works for non-rails.
- Make sure enablement is working (I'm pretty sure I broke it)
- Make sure I didn't break anything that was threadsafe
- Add tests for any new functionality you write
- Check for all TODOs, FIXMEs, etc
- Added Bundler confifiguration setting to make
:github
source inGemfile
useHTTPS
. (Was triggering warning with latest Bundler.) - Restructured directories and code locations so that it would make intuitive sense (and also so that code would be compatible with autoloaders without manual
require
s or additional configuration). - Removed reliance on
rails
andrailties
gems. - You can no longer redefine the method #observed_classes in ActiveModel::Observer subclasses. You can either use
observe :class
orobserved_classes = :class
activesupport-5.0.1/lib/active_support/dependencies.rb:509
inload_missing_constant
: Circular dependency detected while autoloading constantUser
(RuntimeError
)- from
activesupport-5.0.1/lib/active_support/dependencies.rb:203
inconst_missing
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:268
inconst_get
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:268
inblock
inconstantize
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:266
ineach
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:266
ininject
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:266
inconstantize
- from
activesupport-5.0.1/lib/active_support/inflector/methods.rb:311
insafe_constantize
- from
activesupport-5.0.1/lib/active_support/core_ext/string/inflections.rb:77
insafe_constantize
- from
activesupport-5.0.1/lib/active_support/core_ext/object/try.rb:17
inpublic_send
- from
activesupport-5.0.1/lib/active_support/core_ext/object/try.rb:17
intry!
- from
activesupport-5.0.1/lib/active_support/core_ext/object/try.rb:6
intry
- from
rails-observers/lib/active_model/observer.rb:112
indefault_observed_class
- from
rails-observers/lib/active_model/observer.rb:99
inobserved_classes
- from
rails-observers/lib/active_model/observer.rb:117
inobserved_classes
- from
rails-observers/lib/active_record/observer.rb:101
inobserved_classes
- from
rails-observers/lib/active_model/observer.rb:122
ininitialize
- from
/usr/local/rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/singleton.rb:142
innew
- from
/usr/local/rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/singleton.rb:142
inblock
ininstance
- from
/usr/local/rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/singleton.rb:140
insynchronize
- from
/usr/local/rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/singleton.rb:140
ininstance
- from
rails-observers/lib/active_model/observing/class_methods.rb:171
ininstantiate_observer
- from
rails-observers/lib/active_model/observing/class_methods.rb:99
inblock
ininstantiate_observers
- from
rails-observers/lib/active_model/observing/class_methods.rb:99
ineach
- from
rails-observers/lib/active_model/observing/class_methods.rb:99
ininstantiate_observers
- from
rails-observers/lib/active_model/observing/class_methods.rb:7
ininherited
- from
/tmp/test-app/app/models/application_record.rb:1
in <top (require
d)> - from
activesupport-5.0.1/lib/active_support/dependencies.rb:477
inload
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:477
inblock
inload_file
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:662
innew_constants_in
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:476
inload_file
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:375
inblock
inrequire_or_load
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:37
inblock
inload_interlock
- from
activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:12
inblock in loading
- from
activesupport-5.0.1/lib/active_support/concurrency/share_lock.rb:150
inexclusive
- from
activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:11
inloading
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:37
inload_interlock
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:358
inrequire_or_load
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:511
inload_missing_constant
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:203
inconst_missing
- from
/tmp/test-app/app/models/user.rb:1
in <top (require
d)> - from
activesupport-5.0.1/lib/active_support/dependencies.rb:477
inload
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:477
inblock in load_file
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:662
innew_constants_in
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:476
inload_file
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:375
inblock in require_or_load
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:37
inblock in load_interlock
- from
activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:12
inblock in loading
- from
activesupport-5.0.1/lib/active_support/concurrency/share_lock.rb:150
inexclusive
- from
activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:11
inloading
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:37
inload_interlock
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:358
inrequire_or_load
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:511
inload_missing_constant
- from
activesupport-5.0.1/lib/active_support/dependencies.rb:203
inconst_missing
- from
railties-5.0.1/lib/rails/commands/runner.rb:63
in <top (require
d)> - from
railties-5.0.1/lib/rails/commands/runner.rb:63
ineval
- from
railties-5.0.1/lib/rails/commands/runner.rb:63
in <top (require
d)> - from
railties-5.0.1/lib/rails/commands/commands_tasks.rb:138
inrequire
- from
railties-5.0.1/lib/rails/commands/commands_tasks.rb:138
inrequire_command!
- from
railties-5.0.1/lib/rails/commands/commands_tasks.rb:104
inrunner
- from
railties-5.0.1/lib/rails/commands/commands_tasks.rb:49
inrun_command!
- from
railties-5.0.1/lib/rails/commands.rb:18
in <top (require
d)> - from
bin/rails:4
inrequire
- from
bin/rails:4
in<main>
- from