diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-02-02 05:41:00 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-02-02 05:41:00 +0000 |
commit | 1bce58b31289362d62863ad0600b924858a11e34 (patch) | |
tree | a99ebc764c8e91e04b490bd6145a5201341e50c3 /activesupport/lib/active_support | |
parent | 4bb6f863b42814707c0df6d972c931c6925b3de8 (diff) | |
download | rails-1bce58b31289362d62863ad0600b924858a11e34.tar.gz rails-1bce58b31289362d62863ad0600b924858a11e34.tar.bz2 rails-1bce58b31289362d62863ad0600b924858a11e34.zip |
Add Reloadable::OnlySubclasses which handles the common case where a base class should not be reloaded, but its subclasses should be.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/reloadable.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/reloadable.rb b/activesupport/lib/active_support/reloadable.rb index 49e6442a37..7749f0b165 100644 --- a/activesupport/lib/active_support/reloadable.rb +++ b/activesupport/lib/active_support/reloadable.rb @@ -14,4 +14,15 @@ module Reloadable included_in_classes.select { |klass| klass.reloadable? } end end + + module OnlySubclasses + class << self + def included(base) #nodoc: + base.send :include, Reloadable + (class << base; self; end;).class_eval do + define_method(:reloadable?) { self != base } + end + end + end + end end
\ No newline at end of file |