Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Just go with Subclasses instead of OnlySubclasses

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit ed080863d5783b09cdc7aa397d3622e9b2eefc82 1 parent a6a683b
@dhh dhh authored
View
2  actionpack/lib/action_controller/caching.rb
@@ -523,7 +523,7 @@ class Sweeper < ActiveRecord::Observer #:nodoc:
# ActiveRecord::Observer will mark this class as reloadable even though it should not be.
# However, subclasses of ActionController::Caching::Sweeper should be Reloadable
- include Reloadable::OnlySubclasses
+ include Reloadable::Subclasses
def before(controller)
self.controller = controller
View
6 activerecord/lib/active_record/base.rb
@@ -243,7 +243,7 @@ class Base
# on to any new database connections made and which can be retrieved on both a class and instance level by calling +logger+.
cattr_accessor :logger
- include Reloadable::OnlySubclasses
+ include Reloadable::Subclasses
def self.inherited(child) #:nodoc:
@@subclasses[self] ||= []
@@ -439,9 +439,7 @@ def create(attributes = nil)
attributes.collect { |attr| create(attr) }
else
object = new(attributes)
- if scoped?(:create)
- scope(:create).each { |att,value| object.send("#{att}=", value) }
- end
+ scope(:create).each { |att,value| object.send("#{att}=", value) } if scoped?(:create)
object.save
object
end
View
2  activesupport/lib/active_support/reloadable.rb
@@ -19,7 +19,7 @@ def reloadable_classes
# Captures the common pattern where a base class should not be reloaded,
# but its subclasses should be.
- module OnlySubclasses
+ module Subclasses
def self.included(base) #nodoc:
base.send :include, Reloadable
(class << base; self; end).send(:define_method, :reloadable?) do
View
16 activesupport/test/reloadable_test.rb
@@ -25,14 +25,14 @@ def self.reloadable?
include Reloadable
end
- class OnlySubclassesReloadable
- include Reloadable::OnlySubclasses
+ class SubclassesReloadable
+ include Reloadable::Subclasses
end
- class ASubclassOfOnlySubclassesReloadable < OnlySubclassesReloadable
+ class ASubclassOfSubclassesReloadable < SubclassesReloadable
end
class AnOnlySubclassReloadableClassSubclassingAReloadableClass
- include Reloadable::OnlySubclasses
+ include Reloadable::Subclasses
end
class ASubclassofAOnlySubclassReloadableClassWhichWasSubclassingAReloadableClass < AnOnlySubclassReloadableClassSubclassingAReloadableClass
@@ -51,8 +51,8 @@ def test_reloadable_is_not_overwritten_if_present
end
def test_only_subclass_reloadable
- assert ! ReloadableTestSandbox::OnlySubclassesReloadable.reloadable?
- assert ReloadableTestSandbox::ASubclassOfOnlySubclassesReloadable.reloadable?
+ assert ! ReloadableTestSandbox::SubclassesReloadable.reloadable?
+ assert ReloadableTestSandbox::ASubclassOfSubclassesReloadable.reloadable?
end
def test_inside_hierarchy_only_subclass_reloadable
@@ -66,11 +66,11 @@ def test_removable_classes
AReloadableClassWithSubclasses
AReloadableSubclass
AClassWhichDefinesItsOwnReloadable
- ASubclassOfOnlySubclassesReloadable
+ ASubclassOfSubclassesReloadable
)
non_reloadables = %w(
ANonReloadableSubclass
- OnlySubclassesReloadable
+ SubclassesReloadable
)
results = Reloadable.reloadable_classes
Please sign in to comment.
Something went wrong with that request. Please try again.