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

Changeset 2627

Show
Ignore:
Timestamp:
10/15/05 20:49:04 (3 years ago)
Author:
minam
Message:

Allow ARStore::Session to indicate that it should not be reloaded in dev mode

Files:

Legend:

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

    r2612 r2627  
    4747        class << self 
    4848 
     49          # Don't try to reload ARStore::Session in dev mode. 
     50          def reloadable? #:nodoc: 
     51            false 
     52          end 
     53           
    4954          def data_column_size_limit 
    5055            connection.columns(table_name).find {|column| column.name == 'data'}.limit 
  • trunk/activerecord/lib/active_record/base.rb

    r2620 r2627  
    257257      super 
    258258    end 
     259     
     260    # Allow all subclasses of AR::Base to be reloaded in dev mode, unless they 
     261    # explicitly decline the honor. USE WITH CAUTION. Only AR subclasses kept 
     262    # in the framework should use the flag, so #reset_subclasses and so forth 
     263    # leave it alone. 
     264    def self.reloadable? #:nodoc: 
     265      true 
     266    end 
    259267 
    260268    def self.reset_subclasses 
     269      nonreloadables = [] 
    261270      subclasses.each do |klass| 
     271        unless klass.reloadable? 
     272          nonreloadables << klass 
     273          next 
     274        end 
    262275        klass.instance_variables.each { |var| klass.send(:remove_instance_variable, var) } 
    263276        klass.instance_methods(false).each { |m| klass.send :undef_method, m } 
    264277      end 
    265       @@subclasses.clear 
     278      @@subclasses = {} 
     279      nonreloadables.each { |klass| (@@subclasses[klass.superclass] ||= []) << klass } 
    266280    end 
    267281