From 1bce58b31289362d62863ad0600b924858a11e34 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Thu, 2 Feb 2006 05:41:00 +0000 Subject: 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 --- activesupport/lib/active_support/reloadable.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activesupport/lib/active_support') 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 -- cgit v1.2.3