aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-09-20 11:00:17 -0700
committerJon Leighton <j@jonathanleighton.com>2012-09-20 11:00:17 -0700
commit81084bda1d39f3126235b564487fdb10504f0f48 (patch)
tree15fb0d83a620a182f1243587b9e9a2b27ae625f3 /activerecord
parent6e3532d5e496d611da21f7a5bf67a7d7410400df (diff)
parenta30b8d38b41ba9c141e867836a3a9c5b21221bea (diff)
downloadrails-81084bda1d39f3126235b564487fdb10504f0f48.tar.gz
rails-81084bda1d39f3126235b564487fdb10504f0f48.tar.bz2
rails-81084bda1d39f3126235b564487fdb10504f0f48.zip
Merge pull request #7720 from frodsan/rename_ar_tag
rename AR::Model::Tag to AR::Tag
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md5
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb6
-rw-r--r--activerecord/lib/active_record/inheritance.rb4
-rw-r--r--activerecord/lib/active_record/model.rb12
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder.rb2
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb4
6 files changed, 19 insertions, 14 deletions
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
- #
+ #
#
# <tt>self.abstract_class = true</tt> is required to make <tt>Child<.find,.create, or any Arel method></tt> use <tt>the_table_i_really_want</tt> instead of a table called <tt>super_classes</tt>
#
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
- # <tt>ActiveRecord::Model</tt> can be included into a class to add Active Record persistence.
- # This is an alternative to inheriting from <tt>ActiveRecord::Base</tt>. Example:
+ # This allows us to detect an ActiveRecord::Model while it's in the process of
+ # being included.
+ module Tag; end
+
+ # <tt>ActiveRecord::Model</tt> can be included into a class to add Active Record
+ # persistence. This is an alternative to inheriting from <tt>ActiveRecord::Base</tt>.
#
# 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