Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5211 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
25cce68013
commit
52547f5331
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]
|
||||||
|
|
||||||
* Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. #6287 [Bob Silva]
|
* Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. #6287 [Bob Silva]
|
||||||
|
|
||||||
* has_one associations with a nil target may be safely marshaled. #6279 [norbauer, Jeremy Kemper]
|
* has_one associations with a nil target may be safely marshaled. #6279 [norbauer, Jeremy Kemper]
|
||||||
|
|
|
@ -18,10 +18,18 @@ module ActiveRecord
|
||||||
#
|
#
|
||||||
# # Same as above, just using explicit class references
|
# # Same as above, just using explicit class references
|
||||||
# ActiveRecord::Base.observers = Cacher, GarbageCollector
|
# ActiveRecord::Base.observers = Cacher, GarbageCollector
|
||||||
|
#
|
||||||
|
# Note: Setting this does not instantiate the observers yet. #instantiate_observers is
|
||||||
|
# called during startup, and before each development request.
|
||||||
def observers=(*observers)
|
def observers=(*observers)
|
||||||
@observers = observers.flatten
|
@observers = observers.flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Gets the current observers.
|
||||||
|
def observers
|
||||||
|
@observers ||= []
|
||||||
|
end
|
||||||
|
|
||||||
# Instantiate the global ActiveRecord observers
|
# Instantiate the global ActiveRecord observers
|
||||||
def instantiate_observers
|
def instantiate_observers
|
||||||
return if @observers.blank?
|
return if @observers.blank?
|
||||||
|
|
Loading…
Reference in New Issue