It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
Allow extra arguments for Observers
Fix Observer by acting on singleton class. Fixes #3505.
- can pass the class, not the instance - "instance method" is confusing, use "method :instance" instead
Rename Observing#count_observers to Observing#observers_count
that the method accepts multiple arguments
We have to use Observer#update rather than Observer#send since the enabled state is checked in #update before forwarding the method call on.
Now that we propagate the enabling/disabling to descendants, we no longer have to check the disabled_observer Set on each superclass of the model class. This was causing a bug when disabling all observers at a superclass level and then enabling an individual observer at a subclass level. Plus the logic is simpler now :).
…keeping track of subclasses manually. There's also no need to keep track of all ObserverArray instances in a hash, as this is likely to leak memory, too.
…ls of the class hierarchy."" This reverts commit 2a25c58. I'm going to add another commit that keeps the same behavior of fixes the problems of leaking memory in development.
…e class hierarchy." This reverts commit ad62f19 because the current subclasses implementation leaks memory in development. Instead of keeping an array of subclasses, the better solution is to ask the parent if an observer is being disabled or not.