Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3166

Show
Ignore:
Timestamp:
11/23/05 00:35:37 (3 years ago)
Author:
bitsweat
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/session_management.rb

    r2649 r3166  
    1212      base.send(:alias_method, :process_without_session_management_support, :process) 
    1313      base.send(:alias_method, :process, :process_with_session_management_support) 
    14       base.after_filter(:clear_persistant_model_associations) 
     14      base.after_filter(:clear_persistent_model_associations) 
    1515    end 
    1616 
     
    116116      process_without_session_management_support(request, response, method, *arguments) 
    117117    end 
    118    
     118 
    119119    private 
    120       def clear_persistant_model_associations #:doc: 
    121         if session = @session.instance_variable_get("@data") 
    122           session.each { |key, obj| obj.clear_association_cache if obj.respond_to?(:clear_association_cache) } 
     120      # Clear cached associations in session data so they don't overflow 
     121      # the database field.  Only applies to ActiveRecordStore since there 
     122      # is not a standard way to iterate over session data. 
     123      def clear_persistent_model_associations #:doc: 
     124        if defined?(@session) and @session.instance_variables.include?('@data') 
     125          session_data = @session.instance_variable_get('@data') 
     126          if session_data and session_data.respond_to?(:each_value) 
     127            session_data.each_value do |obj| 
     128              if obj.respond_to?(:clear_association_cache) 
     129                obj.clear_association_cache 
     130              end 
     131            end 
     132          end 
    123133        end 
    124134      end