提交 52547f53 编写于 作者: R Rick Olson

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
上级 25cce680
*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]
* has_one associations with a nil target may be safely marshaled. #6279 [norbauer, Jeremy Kemper]
......
......@@ -18,10 +18,18 @@ module ClassMethods
#
# # Same as above, just using explicit class references
# 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)
@observers = observers.flatten
end
# Gets the current observers.
def observers
@observers ||= []
end
# Instantiate the global ActiveRecord observers
def instantiate_observers
return if @observers.blank?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册