提交 202e4208 编写于 作者: J Jeremy Kemper

Correct spelling of persistent [Stefan Kaes]. Document and eliminate warnings...

Correct spelling of persistent [Stefan Kaes].  Document and eliminate warnings in clear_persistent_model_associations.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3166 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 e8f664dd
......@@ -11,7 +11,7 @@ def self.append_features(base)
base.extend(ClassMethods)
base.send(:alias_method, :process_without_session_management_support, :process)
base.send(:alias_method, :process, :process_with_session_management_support)
base.after_filter(:clear_persistant_model_associations)
base.after_filter(:clear_persistent_model_associations)
end
module ClassMethods
......@@ -115,11 +115,21 @@ def process_with_session_management_support(request, response, method = :perform
request.session_options = self.class.session_options_for(request, action)
process_without_session_management_support(request, response, method, *arguments)
end
private
def clear_persistant_model_associations #:doc:
if session = @session.instance_variable_get("@data")
session.each { |key, obj| obj.clear_association_cache if obj.respond_to?(:clear_association_cache) }
# Clear cached associations in session data so they don't overflow
# the database field. Only applies to ActiveRecordStore since there
# is not a standard way to iterate over session data.
def clear_persistent_model_associations #:doc:
if defined?(@session) and @session.instance_variables.include?('@data')
session_data = @session.instance_variable_get('@data')
if session_data and session_data.respond_to?(:each_value)
session_data.each_value do |obj|
if obj.respond_to?(:clear_association_cache)
obj.clear_association_cache
end
end
end
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册