actionpack 5.0.0.rc1 → 5.0.0.rc2

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: b1955895752f4118267917ca255e569360c0f798
4
- data.tar.gz: 47db6b8eba59133e70ade113f75bc17b6ad62ae8
3
+ metadata.gz: 6726cfe03bb6979be6b223595d45593f3e2bdcad
4
+ data.tar.gz: 6ba6ce511d37cf3402201f04b4aefa213f6c43c2
5
5
  SHA512:
6
- metadata.gz: 437de4e739b2a9fcf5c16bf63044a1753d44873fb79d44b13b64cdf26a3a2e0ef6dbd09ed83dce6bc61c26cda9003c09667c175823915c8da74d238a20ef40db
7
- data.tar.gz: 8b82f9eaae837715cca71646c4a898c5287ae74e42e8eb02f4f65f9fb8df452b52ddebee72cabea12305235b287c547a96e28cfabeee71fc6f8e438782870b5d
6
+ metadata.gz: 68bf94b57261623153d59d7b8febcb5089681a2fb713ed2a0f59ce5da36d53f4f8f0d39f1a6020763ad4a172149645d2fc84da1adf3e16922cf2407ac376f543
7
+ data.tar.gz: ae1832ea0ad9301e782cdacb4965d517f89b66b48d9974a5bd824fc3f861caf3c7f07019bda58bf2bb7cfd8014f4152f795db2b3bb02a01669143f12d2e36bbf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Rails 5.0.0.rc2 (June 22, 2016) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.0.0.rc1 (May 06, 2016) ##
2
7
 
3
8
  * Add `ActionController#helpers` to get access to the view context at the controller
@@ -642,6 +647,10 @@
642
647
 
643
648
  *Terence Sun*
644
649
 
650
+ * Discarded flash messages get removed before storing into session.
651
+
652
+ *Samuel Cochran*
653
+
645
654
  * Migrating xhr methods to keyword arguments syntax
646
655
  in `ActionController::TestCase` and `ActionDispatch::Integration`
647
656
 
@@ -810,6 +819,10 @@
810
819
 
811
820
  *Chris Sinjakli*
812
821
 
822
+ * Remove `ActionController::ModelNaming` module.
823
+
824
+ *claudiob*
825
+
813
826
  * Fixed usage of optional scopes in url helpers.
814
827
 
815
828
  *Alex Robbin*
@@ -150,6 +150,13 @@ module AbstractController
150
150
  _find_action_name(action_name)
151
151
  end
152
152
 
153
+ # Tests if a response body is set. Used to determine if the
154
+ # +process_action+ callback needs to be terminated in
155
+ # +AbstractController::Callbacks+.
156
+ def performed?
157
+ response_body
158
+ end
159
+
153
160
  # Returns true if the given controller is capable of rendering
154
161
  # a path. A subclass of +AbstractController::Base+
155
162
  # may return false. An Email controller for example does not
@@ -9,7 +9,7 @@ module AbstractController
9
9
 
10
10
  included do
11
11
  define_callbacks :process_action,
12
- terminator: ->(controller, result_lambda) { result_lambda.call if result_lambda.is_a?(Proc); controller.response_body },
12
+ terminator: ->(controller, result_lambda) { result_lambda.call if result_lambda.is_a?(Proc); controller.performed? },
13
13
  skip_after_callbacks_if_terminated: true
14
14
  end
15
15
 
@@ -122,7 +122,7 @@ module AbstractController
122
122
  def _normalize_render(*args, &block)
123
123
  options = _normalize_args(*args, &block)
124
124
  #TODO: remove defined? when we restore AP <=> AV dependency
125
- if defined?(request) && request.variant.present?
125
+ if defined?(request) && !request.nil? && request.variant.present?
126
126
  options[:variant] = request.variant
127
127
  end
128
128
  _normalize_options(options)
@@ -6,17 +6,6 @@ module ActionController #:nodoc:
6
6
  extend ActiveSupport::Concern
7
7
  include ActiveSupport::Rescuable
8
8
 
9
- def rescue_with_handler(exception)
10
- if exception.cause
11
- handler_index = index_of_handler_for_rescue(exception) || Float::INFINITY
12
- cause_handler_index = index_of_handler_for_rescue(exception.cause)
13
- if cause_handler_index && cause_handler_index <= handler_index
14
- exception = exception.cause
15
- end
16
- end
17
- super(exception)
18
- end
19
-
20
9
  # Override this method if you want to customize when detailed
21
10
  # exceptions must be shown. This method is only called when
22
11
  # consider_all_requests_local is false. By default, it returns
@@ -31,7 +20,7 @@ module ActionController #:nodoc:
31
20
  super
32
21
  rescue Exception => exception
33
22
  request.env['action_dispatch.show_detailed_exceptions'] ||= show_detailed_exceptions?
34
- rescue_with_handler(exception) || raise(exception)
23
+ rescue_with_handler(exception) || raise
35
24
  end
36
25
  end
37
26
  end
@@ -527,34 +527,37 @@ module ActionController
527
527
  @request.set_header k, @controller.config.relative_url_root
528
528
  end
529
529
 
530
- @controller.recycle!
531
- @controller.dispatch(action, @request, @response)
532
- @request = @controller.request
533
- @response = @controller.response
534
-
535
- @request.delete_header 'HTTP_COOKIE'
530
+ begin
531
+ @controller.recycle!
532
+ @controller.dispatch(action, @request, @response)
533
+ ensure
534
+ @request = @controller.request
535
+ @response = @controller.response
536
+
537
+ @request.delete_header 'HTTP_COOKIE'
538
+
539
+ if @request.have_cookie_jar?
540
+ unless @request.cookie_jar.committed?
541
+ @request.cookie_jar.write(@response)
542
+ self.cookies.update(@request.cookie_jar.instance_variable_get(:@cookies))
543
+ end
544
+ end
545
+ @response.prepare!
536
546
 
537
- if @request.have_cookie_jar?
538
- unless @request.cookie_jar.committed?
539
- @request.cookie_jar.write(@response)
540
- self.cookies.update(@request.cookie_jar.instance_variable_get(:@cookies))
547
+ if flash_value = @request.flash.to_session_value
548
+ @request.session['flash'] = flash_value
549
+ else
550
+ @request.session.delete('flash')
541
551
  end
542
- end
543
- @response.prepare!
544
552
 
545
- if flash_value = @request.flash.to_session_value
546
- @request.session['flash'] = flash_value
547
- else
548
- @request.session.delete('flash')
549
- end
553
+ if xhr
554
+ @request.delete_header 'HTTP_X_REQUESTED_WITH'
555
+ @request.delete_header 'HTTP_ACCEPT'
556
+ end
557
+ @request.query_string = ''
550
558
 
551
- if xhr
552
- @request.delete_header 'HTTP_X_REQUESTED_WITH'
553
- @request.delete_header 'HTTP_ACCEPT'
559
+ @response.sent!
554
560
  end
555
- @request.query_string = ''
556
-
557
- @response.sent!
558
561
 
559
562
  @response
560
563
  end
@@ -120,7 +120,7 @@ module ActionDispatch
120
120
 
121
121
  if options_constraints.is_a?(Hash)
122
122
  @defaults = Hash[options_constraints.find_all { |key, default|
123
- URL_OPTIONS.include?(key) && (String === default || Fixnum === default)
123
+ URL_OPTIONS.include?(key) && (String === default || Integer === default)
124
124
  }].merge @defaults
125
125
  @blocks = blocks
126
126
  constraints.merge! options_constraints
@@ -824,7 +824,7 @@ module ActionDispatch
824
824
 
825
825
  if options[:constraints].is_a?(Hash)
826
826
  defaults = options[:constraints].select do |k, v|
827
- URL_OPTIONS.include?(k) && (v.is_a?(String) || v.is_a?(Fixnum))
827
+ URL_OPTIONS.include?(k) && (v.is_a?(String) || v.is_a?(Integer))
828
828
  end
829
829
 
830
830
  options[:defaults] = defaults.merge(options[:defaults] || {})
@@ -869,11 +869,20 @@ module ActionDispatch
869
869
  # controller "food" do
870
870
  # match "bacon", action: :bacon, via: :get
871
871
  # end
872
- def controller(controller)
873
- @scope = @scope.new(controller: controller)
874
- yield
875
- ensure
876
- @scope = @scope.parent
872
+ def controller(controller, options = {})
873
+ if options.empty?
874
+ begin
875
+ @scope = @scope.new(controller: controller)
876
+ yield
877
+ ensure
878
+ @scope = @scope.parent
879
+ end
880
+ else
881
+ ActiveSupport::Deprecation.warn "#controller with options is deprecated. If you need to pass more options than the controller name use #scope."
882
+
883
+ options[:controller] = controller
884
+ scope(options) { yield }
885
+ end
877
886
  end
878
887
 
879
888
  # Scopes routes to a specific namespace. For example:
@@ -1,14 +1,7 @@
1
1
  module ActionDispatch
2
- # This is a class that abstracts away an asserted response.
3
- # It purposely does not inherit from Response, because it doesn't need it.
4
- # That means it does not have headers or a body.
5
- #
6
- # As an input to the initializer, we take a Fixnum, a String, or a Symbol.
7
- # If it's a Fixnum or String, we figure out what its symbolized name.
8
- # If it's a Symbol, we figure out what its corresponding code is.
9
- # The resulting code will be a Fixnum, for real HTTP codes, and it will
10
- # be a String for the pseudo-HTTP codes, such as:
11
- # :success, :missing, :redirect and :error
2
+ # This is a class that abstracts away an asserted response. It purposely
3
+ # does not inherit from Response because it doesn't need it. That means it
4
+ # does not have headers or a body.
12
5
  class AssertionResponse
13
6
  attr_reader :code, :name
14
7
 
@@ -19,6 +12,9 @@ module ActionDispatch
19
12
  error: "5XX"
20
13
  }
21
14
 
15
+ # Accepts a specific response status code as an Integer (404) or String
16
+ # ('404') or a response status range as a Symbol pseudo-code (:success,
17
+ # indicating any 200-299 status code).
22
18
  def initialize(code_or_name)
23
19
  if code_or_name.is_a?(Symbol)
24
20
  @name = code_or_name
@@ -300,7 +300,7 @@ module ActionDispatch
300
300
  end
301
301
  end
302
302
 
303
- REQUEST_KWARGS = %i(params headers env xhr)
303
+ REQUEST_KWARGS = %i(params headers env xhr as)
304
304
  def kwarg_request?(args)
305
305
  args[0].respond_to?(:keys) && args[0].keys.any? { |k| REQUEST_KWARGS.include?(k) }
306
306
  end
@@ -317,7 +317,8 @@ module ActionDispatch
317
317
  params: { id: 1 },
318
318
  headers: { 'X-Extra-Header' => '123' },
319
319
  env: { 'action_dispatch.custom' => 'custom' },
320
- xhr: true
320
+ xhr: true,
321
+ as: :json
321
322
  MSG
322
323
  end
323
324
 
@@ -8,7 +8,7 @@ module ActionPack
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "rc1"
11
+ PRE = "rc2"
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.0.0.rc1
4
+ version: 5.0.0.rc2
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: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-06-22 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.0.0.rc1
19
+ version: 5.0.0.rc2
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.0.0.rc1
26
+ version: 5.0.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 5.0.0.rc1
101
+ version: 5.0.0.rc2
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 5.0.0.rc1
108
+ version: 5.0.0.rc2
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: activemodel
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 5.0.0.rc1
115
+ version: 5.0.0.rc2
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 5.0.0.rc1
122
+ version: 5.0.0.rc2
123
123
  description: Web apps on Rails. Simple, battle-tested conventions for building and
124
124
  testing MVC web applications. Works with any Rack-compatible server.
125
125
  email: david@loudthinking.com
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  requirements:
303
303
  - none
304
304
  rubyforge_project:
305
- rubygems_version: 2.5.1
305
+ rubygems_version: 2.6.4
306
306
  signing_key:
307
307
  specification_version: 4
308
308
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).