actionpack 5.0.0.beta4 → 5.0.0.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/abstract_controller/rendering.rb +1 -3
- data/lib/action_controller/base.rb +5 -4
- data/lib/action_controller/metal/helpers.rb +6 -1
- data/lib/action_controller/metal/live.rb +8 -8
- data/lib/action_controller/metal/renderers.rb +1 -1
- data/lib/action_controller/metal/rescue.rb +2 -2
- data/lib/action_controller/metal/strong_parameters.rb +3 -3
- data/lib/action_controller/renderer.rb +2 -2
- data/lib/action_controller/test_case.rb +2 -0
- data/lib/action_dispatch/http/mime_negotiation.rb +1 -1
- data/lib/action_dispatch/http/response.rb +24 -9
- data/lib/action_dispatch/middleware/flash.rb +1 -1
- data/lib/action_dispatch/request/session.rb +5 -1
- data/lib/action_dispatch/testing/test_request.rb +11 -11
- data/lib/action_pack/gem_version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1955895752f4118267917ca255e569360c0f798
|
4
|
+
data.tar.gz: 47db6b8eba59133e70ade113f75bc17b6ad62ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 437de4e739b2a9fcf5c16bf63044a1753d44873fb79d44b13b64cdf26a3a2e0ef6dbd09ed83dce6bc61c26cda9003c09667c175823915c8da74d238a20ef40db
|
7
|
+
data.tar.gz: 8b82f9eaae837715cca71646c4a898c5287ae74e42e8eb02f4f65f9fb8df452b52ddebee72cabea12305235b287c547a96e28cfabeee71fc6f8e438782870b5d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## Rails 5.0.0.rc1 (May 06, 2016) ##
|
2
|
+
|
3
|
+
* Add `ActionController#helpers` to get access to the view context at the controller
|
4
|
+
level.
|
5
|
+
|
6
|
+
*Rafael Mendonça França*
|
7
|
+
|
8
|
+
|
1
9
|
## Rails 5.0.0.beta4 (April 27, 2016) ##
|
2
10
|
|
3
11
|
* Routing: Refactor `:action` default handling to ensure that path
|
@@ -60,9 +60,7 @@ module AbstractController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
DEFAULT_PROTECTED_INSTANCE_VARIABLES = Set.new %i(
|
63
|
-
@_action_name @_response_body @_formats @_prefixes
|
64
|
-
@_view_context_class @_view_renderer @_lookup_context
|
65
|
-
@_routes @_db_runtime
|
63
|
+
@_action_name @_response_body @_formats @_prefixes
|
66
64
|
)
|
67
65
|
|
68
66
|
# This method should return a hash with assigns.
|
@@ -229,7 +229,7 @@ module ActionController
|
|
229
229
|
HttpAuthentication::Digest::ControllerMethods,
|
230
230
|
HttpAuthentication::Token::ControllerMethods,
|
231
231
|
|
232
|
-
# Before callbacks should also be executed
|
232
|
+
# Before callbacks should also be executed as early as possible, so
|
233
233
|
# also include them at the bottom.
|
234
234
|
AbstractController::Callbacks,
|
235
235
|
|
@@ -251,9 +251,10 @@ module ActionController
|
|
251
251
|
setup_renderer!
|
252
252
|
|
253
253
|
# Define some internal variables that should not be propagated to the view.
|
254
|
-
PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES +
|
255
|
-
|
256
|
-
|
254
|
+
PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + %i(
|
255
|
+
@_params @_response @_request @_config @_url_options @_action_has_layout @_view_context_class
|
256
|
+
@_view_renderer @_lookup_context @_routes @_view_runtime @_db_runtime @_helper_proxy
|
257
|
+
)
|
257
258
|
|
258
259
|
def _protected_ivars # :nodoc:
|
259
260
|
PROTECTED_IVARS
|
@@ -5,7 +5,7 @@ module ActionController
|
|
5
5
|
#
|
6
6
|
# In addition to using the standard template helpers provided, creating custom helpers to
|
7
7
|
# extract complicated logic or reusable functionality is strongly encouraged. By default, each controller
|
8
|
-
# will include all helpers. These helpers are only accessible on the controller through <tt
|
8
|
+
# will include all helpers. These helpers are only accessible on the controller through <tt>#helpers</tt>
|
9
9
|
#
|
10
10
|
# In previous versions of \Rails the controller will include a helper which
|
11
11
|
# matches the name of the controller, e.g., <tt>MyController</tt> will automatically
|
@@ -113,5 +113,10 @@ module ActionController
|
|
113
113
|
all_helpers_from_path(helpers_path)
|
114
114
|
end
|
115
115
|
end
|
116
|
+
|
117
|
+
# Provides a proxy to access helpers methods from outside the view.
|
118
|
+
def helpers
|
119
|
+
@_helper_proxy ||= view_context
|
120
|
+
end
|
116
121
|
end
|
117
122
|
end
|
@@ -163,14 +163,6 @@ module ActionController
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
def each
|
167
|
-
@response.sending!
|
168
|
-
while str = @buf.pop
|
169
|
-
yield str
|
170
|
-
end
|
171
|
-
@response.sent!
|
172
|
-
end
|
173
|
-
|
174
166
|
# Write a 'close' event to the buffer; the producer/writing thread
|
175
167
|
# uses this to notify us that it's finished supplying content.
|
176
168
|
#
|
@@ -210,6 +202,14 @@ module ActionController
|
|
210
202
|
def call_on_error
|
211
203
|
@error_callback.call
|
212
204
|
end
|
205
|
+
|
206
|
+
private
|
207
|
+
|
208
|
+
def each_chunk(&block)
|
209
|
+
while str = @buf.pop
|
210
|
+
yield str
|
211
|
+
end
|
212
|
+
end
|
213
213
|
end
|
214
214
|
|
215
215
|
class Response < ActionDispatch::Response #:nodoc: all
|
@@ -103,7 +103,7 @@ module ActionController
|
|
103
103
|
#
|
104
104
|
# Both <tt>ActionController::Base</tt> and <tt>ActionController::API</tt>
|
105
105
|
# include <tt>ActionController::Renderers::All</tt>, making all renderers
|
106
|
-
#
|
106
|
+
# available in the controller. See <tt>Renderers::RENDERERS</tt> and <tt>Renderers.add</tt>.
|
107
107
|
#
|
108
108
|
# Since <tt>ActionController::Metal</tt> controllers cannot render, the controller
|
109
109
|
# must include <tt>AbstractController::Rendering</tt>, <tt>ActionController::Rendering</tt>,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ActionController #:nodoc:
|
2
|
-
# This module is responsible
|
3
|
-
# to controllers and
|
2
|
+
# This module is responsible for providing `rescue_from` helpers
|
3
|
+
# to controllers and configuring when detailed exceptions must be
|
4
4
|
# shown.
|
5
5
|
module Rescue
|
6
6
|
extend ActiveSupport::Concern
|
@@ -43,7 +43,7 @@ module ActionController
|
|
43
43
|
|
44
44
|
# == Action Controller \Parameters
|
45
45
|
#
|
46
|
-
# Allows to choose which attributes should be whitelisted for mass updating
|
46
|
+
# Allows you to choose which attributes should be whitelisted for mass updating
|
47
47
|
# and thus prevent accidentally exposing that which shouldn't be exposed.
|
48
48
|
# Provides two methods for this purpose: #require and #permit. The former is
|
49
49
|
# used to mark parameters as required. The latter is used to set the parameter
|
@@ -196,7 +196,7 @@ module ActionController
|
|
196
196
|
end
|
197
197
|
alias_method :to_unsafe_hash, :to_unsafe_h
|
198
198
|
|
199
|
-
# Convert all hashes in values into parameters, then yield each pair
|
199
|
+
# Convert all hashes in values into parameters, then yield each pair in
|
200
200
|
# the same way as <tt>Hash#each_pair</tt>
|
201
201
|
def each_pair(&block)
|
202
202
|
@parameters.each_pair do |key, value|
|
@@ -278,7 +278,7 @@ module ActionController
|
|
278
278
|
# params = ActionController::Parameters.new(user: { ... }, profile: { ... })
|
279
279
|
# user_params, profile_params = params.require(:user, :profile)
|
280
280
|
#
|
281
|
-
# Otherwise, the method
|
281
|
+
# Otherwise, the method re-raises the first exception found:
|
282
282
|
#
|
283
283
|
# params = ActionController::Parameters.new(user: {}, profile: {})
|
284
284
|
# user_params, profile_params = params.require(:user, :profile)
|
@@ -13,11 +13,11 @@ module ActionController
|
|
13
13
|
#
|
14
14
|
# ApplicationController.renderer.render template: '...'
|
15
15
|
#
|
16
|
-
# You can use
|
16
|
+
# You can use this shortcut in a controller, instead of the previous example:
|
17
17
|
#
|
18
18
|
# ApplicationController.render template: '...'
|
19
19
|
#
|
20
|
-
# #render
|
20
|
+
# #render allows you to use the same options that you can use when rendering in a controller.
|
21
21
|
# For example,
|
22
22
|
#
|
23
23
|
# FooController.render :action, locals: { ... }, assigns: { ... }
|
@@ -164,7 +164,7 @@ module ActionDispatch
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def format_from_path_extension
|
167
|
-
path =
|
167
|
+
path = get_header('action_dispatch.original_path') || get_header('PATH_INFO')
|
168
168
|
if match = path && path.match(/\.(\w+)\z/)
|
169
169
|
Mime[match.captures.first]
|
170
170
|
end
|
@@ -68,7 +68,13 @@ module ActionDispatch # :nodoc:
|
|
68
68
|
alias_method :headers, :header
|
69
69
|
|
70
70
|
delegate :[], :[]=, :to => :@header
|
71
|
-
|
71
|
+
|
72
|
+
def each(&block)
|
73
|
+
sending!
|
74
|
+
x = @stream.each(&block)
|
75
|
+
sent!
|
76
|
+
x
|
77
|
+
end
|
72
78
|
|
73
79
|
CONTENT_TYPE = "Content-Type".freeze
|
74
80
|
SET_COOKIE = "Set-Cookie".freeze
|
@@ -97,10 +103,10 @@ module ActionDispatch # :nodoc:
|
|
97
103
|
|
98
104
|
def body
|
99
105
|
@str_body ||= begin
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
106
|
+
buf = ''
|
107
|
+
each { |chunk| buf << chunk }
|
108
|
+
buf
|
109
|
+
end
|
104
110
|
end
|
105
111
|
|
106
112
|
def write(string)
|
@@ -112,10 +118,13 @@ module ActionDispatch # :nodoc:
|
|
112
118
|
end
|
113
119
|
|
114
120
|
def each(&block)
|
115
|
-
@
|
116
|
-
|
117
|
-
|
118
|
-
|
121
|
+
if @str_body
|
122
|
+
return enum_for(:each) unless block_given?
|
123
|
+
|
124
|
+
yield @str_body
|
125
|
+
else
|
126
|
+
each_chunk(&block)
|
127
|
+
end
|
119
128
|
end
|
120
129
|
|
121
130
|
def abort
|
@@ -129,6 +138,12 @@ module ActionDispatch # :nodoc:
|
|
129
138
|
def closed?
|
130
139
|
@closed
|
131
140
|
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def each_chunk(&block)
|
145
|
+
@buf.each(&block) # extract into own method
|
146
|
+
end
|
132
147
|
end
|
133
148
|
|
134
149
|
def self.create(status = 200, header = {}, body = [], default_headers: self.default_headers)
|
@@ -133,7 +133,7 @@ module ActionDispatch
|
|
133
133
|
def to_session_value #:nodoc:
|
134
134
|
flashes_to_keep = @flashes.except(*@discard)
|
135
135
|
return nil if flashes_to_keep.empty?
|
136
|
-
{'flashes' => flashes_to_keep}
|
136
|
+
{ 'discard' => [], 'flashes' => flashes_to_keep }
|
137
137
|
end
|
138
138
|
|
139
139
|
def initialize(flashes = {}, discard = []) #:nodoc:
|
@@ -9,7 +9,7 @@ module ActionDispatch
|
|
9
9
|
|
10
10
|
# Singleton object used to determine if an optional param wasn't specified
|
11
11
|
Unspecified = Object.new
|
12
|
-
|
12
|
+
|
13
13
|
# Creates a session hash, merging the properties of the previous session if any
|
14
14
|
def self.create(store, req, default_options)
|
15
15
|
session_was = find req
|
@@ -198,6 +198,10 @@ module ActionDispatch
|
|
198
198
|
@delegate.merge!(other)
|
199
199
|
end
|
200
200
|
|
201
|
+
def each(&block)
|
202
|
+
to_hash.each(&block)
|
203
|
+
end
|
204
|
+
|
201
205
|
private
|
202
206
|
|
203
207
|
def load_for_read!
|
@@ -22,23 +22,23 @@ module ActionDispatch
|
|
22
22
|
private_class_method :default_env
|
23
23
|
|
24
24
|
def request_method=(method)
|
25
|
-
|
25
|
+
set_header('REQUEST_METHOD', method.to_s.upcase)
|
26
26
|
end
|
27
27
|
|
28
28
|
def host=(host)
|
29
|
-
|
29
|
+
set_header('HTTP_HOST', host)
|
30
30
|
end
|
31
31
|
|
32
32
|
def port=(number)
|
33
|
-
|
33
|
+
set_header('SERVER_PORT', number.to_i)
|
34
34
|
end
|
35
35
|
|
36
36
|
def request_uri=(uri)
|
37
|
-
|
37
|
+
set_header('REQUEST_URI', uri)
|
38
38
|
end
|
39
39
|
|
40
40
|
def path=(path)
|
41
|
-
|
41
|
+
set_header('PATH_INFO', path)
|
42
42
|
end
|
43
43
|
|
44
44
|
def action=(action_name)
|
@@ -46,24 +46,24 @@ module ActionDispatch
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def if_modified_since=(last_modified)
|
49
|
-
|
49
|
+
set_header('HTTP_IF_MODIFIED_SINCE', last_modified)
|
50
50
|
end
|
51
51
|
|
52
52
|
def if_none_match=(etag)
|
53
|
-
|
53
|
+
set_header('HTTP_IF_NONE_MATCH', etag)
|
54
54
|
end
|
55
55
|
|
56
56
|
def remote_addr=(addr)
|
57
|
-
|
57
|
+
set_header('REMOTE_ADDR', addr)
|
58
58
|
end
|
59
59
|
|
60
60
|
def user_agent=(user_agent)
|
61
|
-
|
61
|
+
set_header('HTTP_USER_AGENT', user_agent)
|
62
62
|
end
|
63
63
|
|
64
64
|
def accept=(mime_types)
|
65
|
-
|
66
|
-
|
65
|
+
delete_header('action_dispatch.request.accepts')
|
66
|
+
set_header('HTTP_ACCEPT', Array(mime_types).collect(&:to_s).join(","))
|
67
67
|
end
|
68
68
|
end
|
69
69
|
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.
|
4
|
+
version: 5.0.0.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: 2016-
|
11
|
+
date: 2016-05-06 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.
|
19
|
+
version: 5.0.0.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.0.0.
|
26
|
+
version: 5.0.0.rc1
|
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.
|
101
|
+
version: 5.0.0.rc1
|
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.
|
108
|
+
version: 5.0.0.rc1
|
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.
|
115
|
+
version: 5.0.0.rc1
|
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.
|
122
|
+
version: 5.0.0.rc1
|
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.
|
305
|
+
rubygems_version: 2.5.1
|
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).
|