aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb4
-rw-r--r--activesupport/lib/active_support/callbacks.rb44
-rw-r--r--railties/lib/rails/test_unit/testing.rake22
4 files changed, 45 insertions, 31 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
index 891c87ac27..bc5d03dc10 100644
--- a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
+++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
@@ -34,6 +34,12 @@
padding: 0.5em 1.5em;
}
+ h1 {
+ margin: 0.2em 0;
+ line-height: 1.1em;
+ font-size: 2em;
+ }
+
h2 {
color: #C52F24;
line-height: 25px;
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 654aac8453..df729259e9 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -20,8 +20,8 @@ module ActiveRecord
VALID_CONN_PARAMS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout,
:client_encoding, :options, :application_name, :fallback_application_name,
:keepalives, :keepalives_idle, :keepalives_interval, :keepalives_count,
- :tty, :sslmode, :requiressl, :sslcert, :sslkey, :sslrootcert, :sslcrl,
- :requirepeer, :krbsrvname, :gsslib, :service]
+ :tty, :sslmode, :requiressl, :sslcompression, :sslcert, :sslkey,
+ :sslrootcert, :sslcrl, :requirepeer, :krbsrvname, :gsslib, :service]
# Establishes a connection to the database that's used by all Active Record objects
def postgresql_connection(config)
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 893c2500d7..f0389d0a1c 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -132,6 +132,10 @@ module ActiveSupport
@@_callback_sequence += 1
end
+ def object_filter?
+ @_is_object_filter
+ end
+
def matches?(_kind, _filter)
if @_is_object_filter
_filter_matches = @filter.to_s.start_with?(_method_name_for_object_filter(_kind, _filter, false))
@@ -337,6 +341,7 @@ module ActiveSupport
:terminator => "false",
:scope => [ :kind ]
}.merge!(config)
+ @callbacks_hash = Hash.new { |h, k| h[k] = [] }
end
def compile
@@ -361,20 +366,37 @@ module ActiveSupport
private
- def append_one(callback)
- remove_duplicates(callback)
- push(callback)
- end
+ def append_one(callback)
+ handle_duplicates(callback)
+ push(callback)
+ end
- def prepend_one(callback)
- remove_duplicates(callback)
- unshift(callback)
- end
+ def prepend_one(callback)
+ handle_duplicates(callback)
+ unshift(callback)
+ end
- def remove_duplicates(callback)
- delete_if { |c| callback.duplicates?(c) }
- end
+ # We check to see if this callback already exists. If it does (i.e. if
+ # +callback.duplicates?(c)+ for any callback +c+ in the list of
+ # callbacks), then we delete the previously defined callback.
+ #
+ # We make use of the rep-invariant that only one callback exists which
+ # might match the new callback. The +@callbacks_hash+ is keyed on the
+ # +kind+ and +filter+ of the callback, the attributes used to check if
+ # two callbacks match.
+ def handle_duplicates(callback)
+ if callback.object_filter?
+ scan_and_remove_duplicates(callback)
+ else
+ hash_key = [callback.kind, callback.filter]
+ delete @callbacks_hash[hash_key] if @callbacks_hash[hash_key]
+ @callbacks_hash[hash_key] = callback
+ end
+ end
+ def scan_and_remove_duplicates(callback)
+ delete_if { |c| callback.duplicates?(c) }
+ end
end
module ClassMethods
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index 877dd6d254..9263b9b81d 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -121,31 +121,17 @@ namespace :test do
Rails::TestTask.new(single: "test:prepare")
- Rails::TestTask.new(models: "test:prepare") do |t|
- t.pattern = 'test/models/**/*_test.rb'
- end
-
- Rails::TestTask.new(helpers: "test:prepare") do |t|
- t.pattern = 'test/helpers/**/*_test.rb'
+ ["models", "helpers", "controllers", "mailers", "integration"].each do |name|
+ Rails::TestTask.new(name => "test:prepare") do |t|
+ t.pattern = "test/#{name}/**/*_test.rb"
+ end
end
Rails::TestTask.new(units: "test:prepare") do |t|
t.pattern = 'test/{models,helpers,unit}/**/*_test.rb'
end
- Rails::TestTask.new(controllers: "test:prepare") do |t|
- t.pattern = 'test/controllers/**/*_test.rb'
- end
-
- Rails::TestTask.new(mailers: "test:prepare") do |t|
- t.pattern = 'test/mailers/**/*_test.rb'
- end
-
Rails::TestTask.new(functionals: "test:prepare") do |t|
t.pattern = 'test/{controllers,mailers,functional}/**/*_test.rb'
end
-
- Rails::TestTask.new(integration: "test:prepare") do |t|
- t.pattern = 'test/integration/**/*_test.rb'
- end
end