diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 756a0d7196..606ff7eca0 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,10 @@
## Rails 4.0.0 (unreleased) ##
+* Rename `ActiveRecord::Model::Tag` to `ActiveRecord::Tag`.
+ Fix #7714.
+
+ *Francesco Rodriguez*
+
* `ActiveModel::ForbiddenAttributesProtection` is included by default
in Active Record models. Check the docs of `ActiveModel::ForbiddenAttributesProtection`
for more details.
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index f42a5df75f..42bd16db80 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -6,7 +6,7 @@ require 'active_support/core_ext/module/deprecation'
module ActiveRecord
# Raised when a connection could not be obtained within the connection
# acquisition timeout period: because max connections in pool
- # are in use.
+ # are in use.
class ConnectionTimeoutError < ConnectionNotEstablished
end
@@ -417,7 +417,7 @@ module ActiveRecord
# queue for a connection to become available.
#
# Raises:
- # - ConnectionTimeoutError if a connection could not be acquired
+ # - ConnectionTimeoutError if a connection could not be acquired
def acquire_connection
if conn = @available.poll
conn
@@ -567,7 +567,7 @@ module ActiveRecord
class_to_pool[klass] ||= begin
until pool = pool_for(klass)
klass = klass.superclass
- break unless klass < Model::Tag
+ break unless klass < ActiveRecord::Tag
end
class_to_pool[klass] = pool || pool_for(ActiveRecord::Model)
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index 04fff99a6e..35273b0d81 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -50,7 +50,7 @@ module ActiveRecord
# If B < A and C < B and if A is an abstract_class then both B.base_class
# and C.base_class would return B as the answer since A is an abstract_class.
def base_class
- unless self < Model::Tag
+ unless self < ActiveRecord::Tag
raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
end
@@ -73,7 +73,7 @@ module ActiveRecord
# class Child < SuperClass
# self.table_name = 'the_table_i_really_want'
# end
- #
+ #
#
# self.abstract_class = true is required to make Child<.find,.create, or any Arel method> use the_table_i_really_want instead of a table called super_classes
#
diff --git a/activerecord/lib/active_record/model.rb b/activerecord/lib/active_record/model.rb
index 44cde49bd5..16d9d404e3 100644
--- a/activerecord/lib/active_record/model.rb
+++ b/activerecord/lib/active_record/model.rb
@@ -26,21 +26,21 @@ module ActiveRecord
end
end
- # ActiveRecord::Model can be included into a class to add Active Record persistence.
- # This is an alternative to inheriting from ActiveRecord::Base. Example:
+ # This allows us to detect an ActiveRecord::Model while it's in the process of
+ # being included.
+ module Tag; end
+
+ # ActiveRecord::Model can be included into a class to add Active Record
+ # persistence. This is an alternative to inheriting from ActiveRecord::Base.
#
# class Post
# include ActiveRecord::Model
# end
- #
module Model
extend ActiveSupport::Concern
extend ConnectionHandling
extend ActiveModel::Observing::ClassMethods
- # This allows us to detect an ActiveRecord::Model while it's in the process of being included.
- module Tag; end
-
def self.append_features(base)
base.class_eval do
include Tag
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb
index 263fdce250..71030cb5d7 100644
--- a/activerecord/lib/active_record/relation/predicate_builder.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder.rb
@@ -40,7 +40,7 @@ module ActiveRecord
#
# For polymorphic relationships, find the foreign key and type:
# PriceEstimate.where(:estimate_of => treasure)
- if klass && value.class < Model::Tag && reflection = klass.reflect_on_association(column.to_sym)
+ if klass && value.class < ActiveRecord::Tag && reflection = klass.reflect_on_association(column.to_sym)
if reflection.polymorphic?
queries << build(table[reflection.foreign_type], value.class.base_class)
end
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
index e1579d037f..4467ddfc39 100644
--- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb
+++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -4,8 +4,8 @@ module ActiveRecord
module ConnectionAdapters
class ConnectionHandlerTest < ActiveRecord::TestCase
def setup
- @klass = Class.new { include Model::Tag }
- @subklass = Class.new(@klass) { include Model::Tag }
+ @klass = Class.new { include ActiveRecord::Tag }
+ @subklass = Class.new(@klass) { include ActiveRecord::Tag }
@handler = ConnectionHandler.new
@handler.establish_connection @klass, Base.connection_pool.spec