actionpack 5.1.2 → 5.1.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f0fa627224a0935aab8217f2efb106325574848
4
- data.tar.gz: e276797b17a5cb7a2f5fffadeb61f48e04fbf81c
3
+ metadata.gz: ebb4cff7e815dc558be31f6bde9c09189d2c4d3e
4
+ data.tar.gz: b65b7b309ec1899127650936e4213ca313fee55d
5
5
  SHA512:
6
- metadata.gz: b09cdd0cd14de43e21dcbbff10f9dcfd8d7b7a9c7dc3f8d73a31379ea0e88b09ff4cdc380b5c356644056e616130e57f7b9aa04374a62dc75f5a2ccfc8128097
7
- data.tar.gz: e20d72a4465d2903568d8ade9bf3619fcf07973a13c0367af1fb3cd32cede71402c90a7bc4186c5838a6a28de21557e9fe870a0fdd6c84881bab12d8eb9b7217
6
+ metadata.gz: c99db076703a8fed396d063202cf6501afaca25fb33e8b4e415ef010cec2bb5edc36fce5790a9754bfaba66ffe1454608c4c58e146210d270ea3ccd6349a2dee
7
+ data.tar.gz: c158dd8319e7c9d96ec741fe2c55af255e921f847d5bed04178f8d4d8c9dc5285856b70ee57cbbda87d6d33862249b1a4bdda7c7df5491c872006073c745f17e
@@ -1,5 +1,14 @@
1
+ ## Rails 5.1.3.rc1 (July 19, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.1.2 (June 26, 2017) ##
2
7
 
8
+ * Fallback `ActionController::Parameters#to_s` to `Hash#to_s`.
9
+
10
+ *Kir Shatrov*
11
+
3
12
  * `driven_by` now registers poltergeist and capybara-webkit
4
13
 
5
14
  If driver poltergeist or capybara-webkit is set for System Tests,
@@ -283,7 +283,7 @@ module ActionController
283
283
  return false unless request.has_content_type?
284
284
 
285
285
  ref = request.content_mime_type.ref
286
- _wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters[_wrapper_key]
286
+ _wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters.key?(_wrapper_key)
287
287
  end
288
288
  end
289
289
  end
@@ -180,6 +180,13 @@ module ActionController
180
180
  #
181
181
  # Returns a new array of the keys of the parameters.
182
182
 
183
+ ##
184
+ # :method: to_s
185
+ #
186
+ # :call-seq:
187
+ # to_s()
188
+ # Returns the content of the parameters as a string.
189
+
183
190
  ##
184
191
  # :method: value?
185
192
  #
@@ -196,7 +203,7 @@ module ActionController
196
203
  #
197
204
  # Returns a new array of the values of the parameters.
198
205
  delegate :keys, :key?, :has_key?, :values, :has_value?, :value?, :empty?, :include?,
199
- :as_json, to: :@parameters
206
+ :as_json, :to_s, to: :@parameters
200
207
 
201
208
  # By default, never raise an UnpermittedParameters exception if these
202
209
  # params are present. The default includes both 'controller' and 'action'
@@ -26,13 +26,15 @@ module ActionController
26
26
  ActiveSupport::Deprecation.warn("raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.")
27
27
  end
28
28
 
29
- ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
30
- if app.config.action_controller[:always_permitted_parameters]
31
- ActionController::Parameters.always_permitted_parameters =
32
- app.config.action_controller.delete(:always_permitted_parameters)
33
- end
34
- ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
35
- (Rails.env.test? || Rails.env.development?) ? :log : false
29
+ ActiveSupport.on_load(:action_controller) do
30
+ ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
31
+ if app.config.action_controller[:always_permitted_parameters]
32
+ ActionController::Parameters.always_permitted_parameters =
33
+ app.config.action_controller.delete(:always_permitted_parameters)
34
+ end
35
+ ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
36
+ (Rails.env.test? || Rails.env.development?) ? :log : false
37
+ end
36
38
  end
37
39
  end
38
40
 
@@ -33,7 +33,7 @@ module ActionDispatch
33
33
  unless params.valid_encoding?
34
34
  # Raise Rack::Utils::InvalidParameterError for consistency with Rack.
35
35
  # ActionDispatch::Request#GET will re-raise as a BadRequest error.
36
- raise Rack::Utils::InvalidParameterError, "Non UTF-8 value: #{params}"
36
+ raise Rack::Utils::InvalidParameterError, "Invalid encoding for parameter: #{params.scrub}"
37
37
  end
38
38
  end
39
39
  end
@@ -652,18 +652,25 @@ module ActionDispatch
652
652
  def define_generate_prefix(app, name)
653
653
  _route = @set.named_routes.get name
654
654
  _routes = @set
655
- app.routes.define_mounted_helper(name)
655
+
656
+ script_namer = ->(options) do
657
+ prefix_options = options.slice(*_route.segment_keys)
658
+ prefix_options[:relative_url_root] = "".freeze
659
+ # We must actually delete prefix segment keys to avoid passing them to next url_for.
660
+ _route.segment_keys.each { |k| options.delete(k) }
661
+ _routes.url_helpers.send("#{name}_path", prefix_options)
662
+ end
663
+
664
+ app.routes.define_mounted_helper(name, script_namer)
665
+
656
666
  app.routes.extend Module.new {
657
667
  def optimize_routes_generation?; false; end
668
+
658
669
  define_method :find_script_name do |options|
659
670
  if options.key? :script_name
660
671
  super(options)
661
672
  else
662
- prefix_options = options.slice(*_route.segment_keys)
663
- prefix_options[:relative_url_root] = "".freeze
664
- # we must actually delete prefix segment keys to avoid passing them to next url_for
665
- _route.segment_keys.each { |k| options.delete(k) }
666
- _routes.url_helpers.send("#{name}_path", prefix_options)
673
+ script_namer.call(options)
667
674
  end
668
675
  end
669
676
  }
@@ -279,6 +279,8 @@ module ActionDispatch
279
279
  if args.size < path_params_size
280
280
  path_params -= controller_options.keys
281
281
  path_params -= result.keys
282
+ else
283
+ path_params = path_params.dup
282
284
  end
283
285
  inner_options.each_key do |key|
284
286
  path_params.delete(key)
@@ -454,7 +456,7 @@ module ActionDispatch
454
456
  MountedHelpers
455
457
  end
456
458
 
457
- def define_mounted_helper(name)
459
+ def define_mounted_helper(name, script_namer = nil)
458
460
  return if MountedHelpers.method_defined?(name)
459
461
 
460
462
  routes = self
@@ -462,7 +464,7 @@ module ActionDispatch
462
464
 
463
465
  MountedHelpers.class_eval do
464
466
  define_method "_#{name}" do
465
- RoutesProxy.new(routes, _routes_context, helpers)
467
+ RoutesProxy.new(routes, _routes_context, helpers, script_namer)
466
468
  end
467
469
  end
468
470
 
@@ -8,9 +8,10 @@ module ActionDispatch
8
8
  attr_accessor :scope, :routes
9
9
  alias :_routes :routes
10
10
 
11
- def initialize(routes, scope, helpers)
11
+ def initialize(routes, scope, helpers, script_namer = nil)
12
12
  @routes, @scope = routes, scope
13
13
  @helpers = helpers
14
+ @script_namer = script_namer
14
15
  end
15
16
 
16
17
  def url_options
@@ -28,7 +29,9 @@ module ActionDispatch
28
29
  self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
29
30
  def #{method}(*args)
30
31
  options = args.extract_options!
31
- args << url_options.merge((options || {}).symbolize_keys)
32
+ options = url_options.merge((options || {}).symbolize_keys)
33
+ options.reverse_merge!(script_name: @script_namer.call(options)) if @script_namer
34
+ args << options
32
35
  @helpers.#{method}(*args)
33
36
  end
34
37
  RUBY
@@ -9,14 +9,14 @@ module ActionDispatch
9
9
  end
10
10
 
11
11
  def use
12
- register unless rack_test?
12
+ register if registerable?
13
13
 
14
14
  setup
15
15
  end
16
16
 
17
17
  private
18
- def rack_test?
19
- @name == :rack_test
18
+ def registerable?
19
+ [:selenium, :poltergeist, :webkit].include?(@name)
20
20
  end
21
21
 
22
22
  def register
@@ -338,8 +338,7 @@ module ActionDispatch
338
338
  @integration_session = nil
339
339
  end
340
340
 
341
- %w(get post patch put head delete cookies assigns
342
- xml_http_request xhr get_via_redirect post_via_redirect).each do |method|
341
+ %w(get post patch put head delete cookies assigns follow_redirect!).each do |method|
343
342
  define_method(method) do |*args|
344
343
  # reset the html_document variable, except for cookies/assigns calls
345
344
  unless method == "cookies" || method == "assigns"
@@ -7,8 +7,8 @@ module ActionPack
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 1
10
- TINY = 2
11
- PRE = nil
10
+ TINY = 3
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.2
4
+ version: 5.1.3.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.2
19
+ version: 5.1.3.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.1.2
26
+ version: 5.1.3.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.1.2
95
+ version: 5.1.3.rc1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 5.1.2
102
+ version: 5.1.3.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 5.1.2
109
+ version: 5.1.3.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 5.1.2
116
+ version: 5.1.3.rc1
117
117
  description: Web apps on Rails. Simple, battle-tested conventions for building and
118
118
  testing MVC web applications. Works with any Rack-compatible server.
119
119
  email: david@loudthinking.com
@@ -298,9 +298,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
298
  version: 2.2.2
299
299
  required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  requirements:
301
- - - ">="
301
+ - - ">"
302
302
  - !ruby/object:Gem::Version
303
- version: '0'
303
+ version: 1.3.1
304
304
  requirements:
305
305
  - none
306
306
  rubyforge_project: