aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb1
-rw-r--r--actionpack/test/controller/parameters/multi_parameter_attributes_test.rb33
-rw-r--r--activesupport/activesupport.gemspec2
-rw-r--r--activesupport/lib/active_support/backtrace_cleaner.rb1
-rw-r--r--railties/lib/rails/test_help.rb4
-rw-r--r--railties/test/application/middleware/cache_test.rb2
-rwxr-xr-xtools/profile2
8 files changed, 45 insertions, 3 deletions
diff --git a/Gemfile b/Gemfile
index f98e85e749..3b77524077 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,7 +9,8 @@ gem 'rack-test', github: 'brynary/rack-test'
gem 'rack-cache', "~> 1.2"
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
-gem 'turbolinks', github: 'rails/turbolinks'
+gem 'turbolinks'
+gem 'coffee-rails', github: 'rails/coffee-rails'
gem 'journey', github: 'rails/journey', branch: 'master'
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 36fce81d1c..398454d39f 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -178,6 +178,7 @@ module ActionController
case filter
when Symbol, String then
params[filter] = self[filter] if has_key?(filter)
+ keys.grep(/\A#{Regexp.escape(filter)}\(\di\)\z/) { |key| params[key] = self[key] }
when Hash then
self.slice(*filter.keys).each do |key, values|
return unless values
diff --git a/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
new file mode 100644
index 0000000000..2214ec769c
--- /dev/null
+++ b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
@@ -0,0 +1,33 @@
+require 'abstract_unit'
+require 'action_controller/metal/strong_parameters'
+
+class MultiParameterAttributesTest < ActiveSupport::TestCase
+ test "permitted multi-parameter attribute keys" do
+ params = ActionController::Parameters.new({
+ book: {
+ "shipped_at(1i)" => "2012",
+ "shipped_at(2i)" => "3",
+ "shipped_at(3i)" => "25",
+ "shipped_at(4i)" => "10",
+ "shipped_at(5i)" => "15",
+ "published_at(1i)" => "1999",
+ "published_at(2i)" => "2",
+ "published_at(3i)" => "5"
+ }
+ })
+
+ permitted = params.permit book: [ :shipped_at ]
+
+ assert permitted.permitted?
+
+ assert_equal "2012", permitted[:book]["shipped_at(1i)"]
+ assert_equal "3", permitted[:book]["shipped_at(2i)"]
+ assert_equal "25", permitted[:book]["shipped_at(3i)"]
+ assert_equal "10", permitted[:book]["shipped_at(4i)"]
+ assert_equal "15", permitted[:book]["shipped_at(5i)"]
+
+ assert_nil permitted[:book]["published_at(1i)"]
+ assert_nil permitted[:book]["published_at(2i)"]
+ assert_nil permitted[:book]["published_at(3i)"]
+ end
+end
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index fbe82c3de5..30f4ded005 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -22,5 +22,5 @@ Gem::Specification.new do |s|
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('multi_json', '~> 1.3')
s.add_dependency('tzinfo', '~> 0.3.33')
- s.add_dependency('minitest', '~> 4.0')
+ s.add_dependency('minitest', '~> 4.1')
end
diff --git a/activesupport/lib/active_support/backtrace_cleaner.rb b/activesupport/lib/active_support/backtrace_cleaner.rb
index 53d05c3817..47898f8047 100644
--- a/activesupport/lib/active_support/backtrace_cleaner.rb
+++ b/activesupport/lib/active_support/backtrace_cleaner.rb
@@ -45,6 +45,7 @@ module ActiveSupport
filtered
end
end
+ alias :filter :clean
# Adds a filter from the block provided. Each line in the backtrace will be
# mapped against this filter.
diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb
index 581ceaf9ce..aa357dc418 100644
--- a/railties/lib/rails/test_help.rb
+++ b/railties/lib/rails/test_help.rb
@@ -7,6 +7,10 @@ require 'active_support/test_case'
require 'action_controller/test_case'
require 'action_dispatch/testing/integration'
+# Config Rails backtrace in tests.
+require 'rails/backtrace_cleaner'
+MiniTest.backtrace_filter = Rails.backtrace_cleaner
+
# Enable turn if it is available
begin
require 'turn'
diff --git a/railties/test/application/middleware/cache_test.rb b/railties/test/application/middleware/cache_test.rb
index 19d3f3a397..fffe79f9cc 100644
--- a/railties/test/application/middleware/cache_test.rb
+++ b/railties/test/application/middleware/cache_test.rb
@@ -49,6 +49,8 @@ module ApplicationTests
get ':controller(/:action)'
end
RUBY
+
+ add_to_config "config.action_dispatch.rack_cache = true"
end
def test_cache_keeps_if_modified_since
diff --git a/tools/profile b/tools/profile
index 6cc935bce5..d4cfa13f0a 100755
--- a/tools/profile
+++ b/tools/profile
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# Example:
-# tools/profile_requires activesupport/lib/active_support.rb
+# tools/profile activesupport/lib/active_support.rb
abort 'Use REE so you can profile memory and object allocation' unless GC.respond_to?(:enable_stats)
ENV['NO_RELOAD'] ||= '1'