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

Changeset 1741

Show
Ignore:
Timestamp:
07/06/05 18:43:32 (3 years ago)
Author:
david
Message:

Fixed that a SessionRestoreError was thrown if a model object was placed in the session that wasn't available to all controllers. This means that it's no longer necessary to use the 'model :post' work-around in ApplicationController to have a Post model in your session.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r1731 r1741  
     1*SVN* 
     2 
     3* Fixed that a SessionRestoreError was thrown if a model object was placed in the session that wasn't available to all controllers. This means that it's no longer necessary to use the 'model :post' work-around in ApplicationController to have a Post model in your session. 
     4 
     5 
    16*1.9.0* (6 July, 2005) 
    27 
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r1730 r1741  
    9696        return @session 
    9797      rescue ArgumentError => e 
    98         # TODO: Uncomment this on 0.13.1 
    99         # if e.message =~ %r{undefined class/module (\w+)} 
    100         #   begin 
    101         #     Module.const_missing($1) 
    102         #   rescue LoadError, NameError => e 
    103         #     raise( 
    104         #       ActionController::SessionRestoreError,  
    105         #       "Session contained objects where the class definition wasn't available. " + 
    106         #       "Remember to require classes for all objects kept in the session. " + 
    107         #       "(Original exception: #{e.message} [#{e.class}])" 
    108         #     ) 
    109         #   end 
    110         #  
    111         #   retry 
    112         # else 
    113         #   raise 
    114         # end 
    115         raise( 
    116           ActionController::SessionRestoreError,  
    117           "Session contained objects where the class definition wasn't available. " + 
    118           "Remember to require classes for all objects kept in the session. " + 
    119           "(Original exception: #{e.message} [#{e.class}])" 
    120         ) 
     98        if e.message =~ %r{undefined class/module (\w+)} 
     99          begin 
     100            Module.const_missing($1) 
     101          rescue LoadError, NameError => e 
     102            raise( 
     103              ActionController::SessionRestoreError,  
     104              "Session contained objects where the class definition wasn't available. " + 
     105              "Remember to require classes for all objects kept in the session. " + 
     106              "(Original exception: #{e.message} [#{e.class}])" 
     107            ) 
     108          end 
     109         
     110          retry 
     111        else 
     112          raise 
     113        end 
    121114      end 
    122115    end