aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-08-23 01:21:43 +0200
committerXavier Noria <fxn@hashref.com>2010-08-23 01:21:43 +0200
commitb587bfd589cbb4469b9e49bfdd90f033d14adc9a (patch)
treed5fd06c8a1238dca62d3f3b512a6f19b63bc4b0e /activerecord
parent9992a1a4bff1dd666298866c283ba18832da0914 (diff)
parent8d1ee434da3348089daa497980d1e24837ee8be6 (diff)
downloadrails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.tar.gz
rails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.tar.bz2
rails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb5
-rw-r--r--activerecord/lib/active_record/railtie.rb13
-rw-r--r--activerecord/test/cases/migration_test.rb1
3 files changed, 11 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index 96cf2d09db..b5bf7f46ef 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -6,6 +6,11 @@ module ActiveRecord
class Base
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
+
+ if Mysql2::Client.const_defined? :FOUND_ROWS
+ config[:flags] = Mysql2::Client::FOUND_ROWS
+ end
+
client = Mysql2::Client.new(config.symbolize_keys)
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 78fdb77216..94dda4e413 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -16,7 +16,11 @@ module ActiveRecord
config.generators.orm :active_record, :migration => true,
:timestamps => true
- config.app_middleware.insert_after "::ActionDispatch::Callbacks", "ActiveRecord::QueryCache"
+ config.app_middleware.insert_after "::ActionDispatch::Callbacks",
+ "ActiveRecord::QueryCache"
+
+ config.app_middleware.insert_after "::ActionDispatch::Callbacks",
+ "ActiveRecord::ConnectionAdapters::ConnectionManagement"
rake_tasks do
load "active_record/railties/databases.rake"
@@ -74,13 +78,6 @@ module ActiveRecord
end
end
- initializer "active_record.add_concurrency_middleware" do |app|
- if app.config.allow_concurrency
- app.config.middleware.insert_after "::ActionDispatch::Callbacks",
- "ActiveRecord::ConnectionAdapters::ConnectionManagement"
- end
- end
-
config.after_initialize do
ActiveSupport.on_load(:active_record) do
instantiate_observers
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 186bb55c01..96b97fdd8a 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -566,6 +566,7 @@ if ActiveRecord::Base.connection.supports_migrations?
if bob.moment_of_truth.is_a?(DateTime)
with_env_tz 'US/Eastern' do
+ bob.reload
assert_equal DateTime.local_offset, bob.moment_of_truth.offset
assert_not_equal 0, bob.moment_of_truth.offset
assert_not_equal "Z", bob.moment_of_truth.zone