actionpack 4.2.11.3 → 5.0.0.beta1
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 +5 -5
- data/CHANGELOG.md +379 -462
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -3
- data/lib/abstract_controller.rb +0 -2
- data/lib/abstract_controller/base.rb +17 -32
- data/lib/abstract_controller/callbacks.rb +52 -19
- data/lib/abstract_controller/collector.rb +4 -9
- data/lib/abstract_controller/helpers.rb +2 -2
- data/lib/abstract_controller/railties/routes_helpers.rb +2 -2
- data/lib/abstract_controller/rendering.rb +27 -22
- data/lib/abstract_controller/translation.rb +8 -7
- data/lib/action_controller.rb +4 -3
- data/lib/action_controller/api.rb +146 -0
- data/lib/action_controller/base.rb +6 -10
- data/lib/action_controller/caching.rb +1 -3
- data/lib/action_controller/caching/fragments.rb +48 -3
- data/lib/action_controller/form_builder.rb +48 -0
- data/lib/action_controller/log_subscriber.rb +1 -10
- data/lib/action_controller/metal.rb +89 -62
- data/lib/action_controller/metal/basic_implicit_render.rb +11 -0
- data/lib/action_controller/metal/conditional_get.rb +65 -24
- data/lib/action_controller/metal/cookies.rb +0 -2
- data/lib/action_controller/metal/data_streaming.rb +2 -22
- data/lib/action_controller/metal/etag_with_template_digest.rb +1 -1
- data/lib/action_controller/metal/exceptions.rb +11 -6
- data/lib/action_controller/metal/force_ssl.rb +6 -6
- data/lib/action_controller/metal/head.rb +14 -7
- data/lib/action_controller/metal/helpers.rb +9 -5
- data/lib/action_controller/metal/http_authentication.rb +37 -38
- data/lib/action_controller/metal/implicit_render.rb +23 -6
- data/lib/action_controller/metal/instrumentation.rb +0 -1
- data/lib/action_controller/metal/live.rb +17 -55
- data/lib/action_controller/metal/mime_responds.rb +17 -37
- data/lib/action_controller/metal/params_wrapper.rb +8 -8
- data/lib/action_controller/metal/redirecting.rb +32 -9
- data/lib/action_controller/metal/renderers.rb +10 -8
- data/lib/action_controller/metal/rendering.rb +38 -6
- data/lib/action_controller/metal/request_forgery_protection.rb +67 -35
- data/lib/action_controller/metal/rescue.rb +2 -4
- data/lib/action_controller/metal/streaming.rb +4 -4
- data/lib/action_controller/metal/strong_parameters.rb +231 -78
- data/lib/action_controller/metal/testing.rb +1 -12
- data/lib/action_controller/metal/url_for.rb +12 -5
- data/lib/action_controller/renderer.rb +111 -0
- data/lib/action_controller/template_assertions.rb +9 -0
- data/lib/action_controller/test_case.rb +267 -363
- data/lib/action_dispatch.rb +2 -1
- data/lib/action_dispatch/http/cache.rb +23 -26
- data/lib/action_dispatch/http/filter_parameters.rb +6 -8
- data/lib/action_dispatch/http/filter_redirect.rb +7 -8
- data/lib/action_dispatch/http/headers.rb +28 -11
- data/lib/action_dispatch/http/mime_negotiation.rb +40 -26
- data/lib/action_dispatch/http/mime_type.rb +92 -61
- data/lib/action_dispatch/http/mime_types.rb +1 -4
- data/lib/action_dispatch/http/parameter_filter.rb +18 -8
- data/lib/action_dispatch/http/parameters.rb +45 -41
- data/lib/action_dispatch/http/request.rb +146 -82
- data/lib/action_dispatch/http/response.rb +180 -99
- data/lib/action_dispatch/http/url.rb +117 -8
- data/lib/action_dispatch/journey/formatter.rb +34 -28
- data/lib/action_dispatch/journey/gtg/transition_table.rb +1 -1
- data/lib/action_dispatch/journey/nfa/dot.rb +0 -2
- data/lib/action_dispatch/journey/nfa/transition_table.rb +1 -46
- data/lib/action_dispatch/journey/nodes/node.rb +14 -4
- data/lib/action_dispatch/journey/parser_extras.rb +4 -0
- data/lib/action_dispatch/journey/path/pattern.rb +37 -41
- data/lib/action_dispatch/journey/route.rb +71 -17
- data/lib/action_dispatch/journey/router.rb +5 -6
- data/lib/action_dispatch/journey/router/utils.rb +5 -5
- data/lib/action_dispatch/journey/routes.rb +14 -15
- data/lib/action_dispatch/journey/visitors.rb +86 -43
- data/lib/action_dispatch/middleware/cookies.rb +184 -135
- data/lib/action_dispatch/middleware/debug_exceptions.rb +115 -45
- data/lib/action_dispatch/middleware/exception_wrapper.rb +21 -20
- data/lib/action_dispatch/middleware/flash.rb +61 -45
- data/lib/action_dispatch/middleware/load_interlock.rb +21 -0
- data/lib/action_dispatch/middleware/params_parser.rb +30 -46
- data/lib/action_dispatch/middleware/public_exceptions.rb +2 -2
- data/lib/action_dispatch/middleware/reloader.rb +2 -4
- data/lib/action_dispatch/middleware/remote_ip.rb +29 -19
- data/lib/action_dispatch/middleware/request_id.rb +11 -6
- data/lib/action_dispatch/middleware/session/abstract_store.rb +23 -11
- data/lib/action_dispatch/middleware/session/cache_store.rb +9 -6
- data/lib/action_dispatch/middleware/session/cookie_store.rb +29 -23
- data/lib/action_dispatch/middleware/session/mem_cache_store.rb +4 -0
- data/lib/action_dispatch/middleware/show_exceptions.rb +11 -9
- data/lib/action_dispatch/middleware/ssl.rb +93 -36
- data/lib/action_dispatch/middleware/stack.rb +43 -48
- data/lib/action_dispatch/middleware/static.rb +52 -40
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +2 -14
- data/lib/action_dispatch/middleware/templates/rescues/{_source.erb → _source.html.erb} +0 -0
- data/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +1 -1
- data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +4 -4
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +59 -63
- data/lib/action_dispatch/railtie.rb +0 -2
- data/lib/action_dispatch/request/session.rb +66 -34
- data/lib/action_dispatch/request/utils.rb +51 -19
- data/lib/action_dispatch/routing.rb +3 -8
- data/lib/action_dispatch/routing/inspector.rb +6 -30
- data/lib/action_dispatch/routing/mapper.rb +447 -322
- data/lib/action_dispatch/routing/polymorphic_routes.rb +8 -14
- data/lib/action_dispatch/routing/redirection.rb +3 -3
- data/lib/action_dispatch/routing/route_set.rb +124 -227
- data/lib/action_dispatch/routing/url_for.rb +27 -10
- data/lib/action_dispatch/testing/assertions.rb +1 -1
- data/lib/action_dispatch/testing/assertions/response.rb +27 -9
- data/lib/action_dispatch/testing/assertions/routing.rb +9 -9
- data/lib/action_dispatch/testing/integration.rb +237 -76
- data/lib/action_dispatch/testing/test_process.rb +5 -5
- data/lib/action_dispatch/testing/test_request.rb +12 -21
- data/lib/action_dispatch/testing/test_response.rb +1 -4
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/gem_version.rb +4 -4
- metadata +26 -25
- data/lib/action_controller/metal/hide_actions.rb +0 -40
- data/lib/action_controller/metal/rack_delegation.rb +0 -32
- data/lib/action_controller/middleware.rb +0 -39
- data/lib/action_controller/model_naming.rb +0 -12
- data/lib/action_dispatch/journey/router/strexp.rb +0 -27
- data/lib/action_dispatch/testing/assertions/dom.rb +0 -3
- data/lib/action_dispatch/testing/assertions/selector.rb +0 -3
- data/lib/action_dispatch/testing/assertions/tag.rb +0 -3
@@ -5,9 +5,9 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
5
5
|
module ActionDispatch
|
6
6
|
module TestProcess
|
7
7
|
def assigns(key = nil)
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
raise NoMethodError,
|
9
|
+
"assigns has been extracted to a gem. To continue using it,
|
10
|
+
add `gem 'rails-controller-testing'` to your Gemfile."
|
11
11
|
end
|
12
12
|
|
13
13
|
def session
|
@@ -19,14 +19,14 @@ module ActionDispatch
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def cookies
|
22
|
-
@request.
|
22
|
+
@cookie_jar ||= Cookies::CookieJar.build(@request, @request.cookies)
|
23
23
|
end
|
24
24
|
|
25
25
|
def redirect_to_url
|
26
26
|
@response.redirect_url
|
27
27
|
end
|
28
28
|
|
29
|
-
# Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(
|
29
|
+
# Shortcut for <tt>Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.fixture_path, path), type)</tt>:
|
30
30
|
#
|
31
31
|
# post :change_avatar, avatar: fixture_file_upload('files/spongebob.png', 'image/png')
|
32
32
|
#
|
@@ -4,19 +4,22 @@ require 'rack/utils'
|
|
4
4
|
module ActionDispatch
|
5
5
|
class TestRequest < Request
|
6
6
|
DEFAULT_ENV = Rack::MockRequest.env_for('/',
|
7
|
-
'HTTP_HOST'
|
8
|
-
'REMOTE_ADDR'
|
9
|
-
'HTTP_USER_AGENT'
|
7
|
+
'HTTP_HOST' => 'test.host',
|
8
|
+
'REMOTE_ADDR' => '0.0.0.0',
|
9
|
+
'HTTP_USER_AGENT' => 'Rails Testing',
|
10
10
|
)
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
# Create a new test request with default `env` values
|
13
|
+
def self.create(env = {})
|
14
|
+
env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
|
15
|
+
env["rack.request.cookie_hash"] ||= {}.with_indifferent_access
|
16
|
+
new(default_env.merge(env))
|
14
17
|
end
|
15
18
|
|
16
|
-
def
|
17
|
-
|
18
|
-
super(default_env.merge(env))
|
19
|
+
def self.default_env
|
20
|
+
DEFAULT_ENV
|
19
21
|
end
|
22
|
+
private_class_method :default_env
|
20
23
|
|
21
24
|
def request_method=(method)
|
22
25
|
@env['REQUEST_METHOD'] = method.to_s.upcase
|
@@ -60,19 +63,7 @@ module ActionDispatch
|
|
60
63
|
|
61
64
|
def accept=(mime_types)
|
62
65
|
@env.delete('action_dispatch.request.accepts')
|
63
|
-
@env['HTTP_ACCEPT'] = Array(mime_types).collect
|
64
|
-
end
|
65
|
-
|
66
|
-
alias :rack_cookies :cookies
|
67
|
-
|
68
|
-
def cookies
|
69
|
-
@cookies ||= {}.with_indifferent_access
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
def default_env
|
75
|
-
DEFAULT_ENV
|
66
|
+
@env['HTTP_ACCEPT'] = Array(mime_types).collect(&:to_s).join(",")
|
76
67
|
end
|
77
68
|
end
|
78
69
|
end
|
@@ -7,7 +7,7 @@ module ActionDispatch
|
|
7
7
|
# See Response for more information on controller response objects.
|
8
8
|
class TestResponse < Response
|
9
9
|
def self.from_response(response)
|
10
|
-
new response.status, response.headers, response.body
|
10
|
+
new response.status, response.headers, response.body
|
11
11
|
end
|
12
12
|
|
13
13
|
# Was the response successful?
|
@@ -16,9 +16,6 @@ module ActionDispatch
|
|
16
16
|
# Was the URL not found?
|
17
17
|
alias_method :missing?, :not_found?
|
18
18
|
|
19
|
-
# Were we redirected?
|
20
|
-
alias_method :redirect?, :redirection?
|
21
|
-
|
22
19
|
# Was there a server-side error?
|
23
20
|
alias_method :error?, :server_error?
|
24
21
|
end
|
data/lib/action_pack.rb
CHANGED
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:
|
4
|
+
version: 5.0.0.beta1
|
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:
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0.beta1
|
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:
|
26
|
+
version: 5.0.0.beta1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.x
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.x
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack-test
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.6.
|
47
|
+
version: 0.6.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.6.
|
54
|
+
version: 0.6.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails-html-sanitizer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 5.0.0.beta1
|
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:
|
108
|
+
version: 5.0.0.beta1
|
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:
|
115
|
+
version: 5.0.0.beta1
|
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:
|
122
|
+
version: 5.0.0.beta1
|
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
|
@@ -142,11 +142,14 @@ files:
|
|
142
142
|
- lib/abstract_controller/translation.rb
|
143
143
|
- lib/abstract_controller/url_for.rb
|
144
144
|
- lib/action_controller.rb
|
145
|
+
- lib/action_controller/api.rb
|
145
146
|
- lib/action_controller/base.rb
|
146
147
|
- lib/action_controller/caching.rb
|
147
148
|
- lib/action_controller/caching/fragments.rb
|
149
|
+
- lib/action_controller/form_builder.rb
|
148
150
|
- lib/action_controller/log_subscriber.rb
|
149
151
|
- lib/action_controller/metal.rb
|
152
|
+
- lib/action_controller/metal/basic_implicit_render.rb
|
150
153
|
- lib/action_controller/metal/conditional_get.rb
|
151
154
|
- lib/action_controller/metal/cookies.rb
|
152
155
|
- lib/action_controller/metal/data_streaming.rb
|
@@ -156,14 +159,12 @@ files:
|
|
156
159
|
- lib/action_controller/metal/force_ssl.rb
|
157
160
|
- lib/action_controller/metal/head.rb
|
158
161
|
- lib/action_controller/metal/helpers.rb
|
159
|
-
- lib/action_controller/metal/hide_actions.rb
|
160
162
|
- lib/action_controller/metal/http_authentication.rb
|
161
163
|
- lib/action_controller/metal/implicit_render.rb
|
162
164
|
- lib/action_controller/metal/instrumentation.rb
|
163
165
|
- lib/action_controller/metal/live.rb
|
164
166
|
- lib/action_controller/metal/mime_responds.rb
|
165
167
|
- lib/action_controller/metal/params_wrapper.rb
|
166
|
-
- lib/action_controller/metal/rack_delegation.rb
|
167
168
|
- lib/action_controller/metal/redirecting.rb
|
168
169
|
- lib/action_controller/metal/renderers.rb
|
169
170
|
- lib/action_controller/metal/rendering.rb
|
@@ -173,10 +174,10 @@ files:
|
|
173
174
|
- lib/action_controller/metal/strong_parameters.rb
|
174
175
|
- lib/action_controller/metal/testing.rb
|
175
176
|
- lib/action_controller/metal/url_for.rb
|
176
|
-
- lib/action_controller/middleware.rb
|
177
|
-
- lib/action_controller/model_naming.rb
|
178
177
|
- lib/action_controller/railtie.rb
|
179
178
|
- lib/action_controller/railties/helpers.rb
|
179
|
+
- lib/action_controller/renderer.rb
|
180
|
+
- lib/action_controller/template_assertions.rb
|
180
181
|
- lib/action_controller/test_case.rb
|
181
182
|
- lib/action_dispatch.rb
|
182
183
|
- lib/action_dispatch/http/cache.rb
|
@@ -210,7 +211,6 @@ files:
|
|
210
211
|
- lib/action_dispatch/journey/path/pattern.rb
|
211
212
|
- lib/action_dispatch/journey/route.rb
|
212
213
|
- lib/action_dispatch/journey/router.rb
|
213
|
-
- lib/action_dispatch/journey/router/strexp.rb
|
214
214
|
- lib/action_dispatch/journey/router/utils.rb
|
215
215
|
- lib/action_dispatch/journey/routes.rb
|
216
216
|
- lib/action_dispatch/journey/scanner.rb
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- lib/action_dispatch/middleware/debug_exceptions.rb
|
224
224
|
- lib/action_dispatch/middleware/exception_wrapper.rb
|
225
225
|
- lib/action_dispatch/middleware/flash.rb
|
226
|
+
- lib/action_dispatch/middleware/load_interlock.rb
|
226
227
|
- lib/action_dispatch/middleware/params_parser.rb
|
227
228
|
- lib/action_dispatch/middleware/public_exceptions.rb
|
228
229
|
- lib/action_dispatch/middleware/reloader.rb
|
@@ -238,7 +239,8 @@ files:
|
|
238
239
|
- lib/action_dispatch/middleware/static.rb
|
239
240
|
- lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
|
240
241
|
- lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb
|
241
|
-
- lib/action_dispatch/middleware/templates/rescues/_source.erb
|
242
|
+
- lib/action_dispatch/middleware/templates/rescues/_source.html.erb
|
243
|
+
- lib/action_dispatch/middleware/templates/rescues/_source.text.erb
|
242
244
|
- lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
|
243
245
|
- lib/action_dispatch/middleware/templates/rescues/_trace.text.erb
|
244
246
|
- lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb
|
@@ -267,11 +269,8 @@ files:
|
|
267
269
|
- lib/action_dispatch/routing/routes_proxy.rb
|
268
270
|
- lib/action_dispatch/routing/url_for.rb
|
269
271
|
- lib/action_dispatch/testing/assertions.rb
|
270
|
-
- lib/action_dispatch/testing/assertions/dom.rb
|
271
272
|
- lib/action_dispatch/testing/assertions/response.rb
|
272
273
|
- lib/action_dispatch/testing/assertions/routing.rb
|
273
|
-
- lib/action_dispatch/testing/assertions/selector.rb
|
274
|
-
- lib/action_dispatch/testing/assertions/tag.rb
|
275
274
|
- lib/action_dispatch/testing/integration.rb
|
276
275
|
- lib/action_dispatch/testing/test_process.rb
|
277
276
|
- lib/action_dispatch/testing/test_request.rb
|
@@ -291,16 +290,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
291
290
|
requirements:
|
292
291
|
- - ">="
|
293
292
|
- !ruby/object:Gem::Version
|
294
|
-
version:
|
293
|
+
version: 2.2.2
|
295
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
295
|
requirements:
|
297
|
-
- - "
|
296
|
+
- - ">"
|
298
297
|
- !ruby/object:Gem::Version
|
299
|
-
version:
|
298
|
+
version: 1.3.1
|
300
299
|
requirements:
|
301
300
|
- none
|
302
|
-
|
301
|
+
rubyforge_project:
|
302
|
+
rubygems_version: 2.5.1
|
303
303
|
signing_key:
|
304
304
|
specification_version: 4
|
305
305
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|
306
306
|
test_files: []
|
307
|
+
has_rdoc:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
|
2
|
-
module ActionController
|
3
|
-
# Adds the ability to prevent public methods on a controller to be called as actions.
|
4
|
-
module HideActions
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
class_attribute :hidden_actions
|
9
|
-
self.hidden_actions = Set.new.freeze
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
# Overrides AbstractController::Base#action_method? to return false if the
|
15
|
-
# action name is in the list of hidden actions.
|
16
|
-
def method_for_action(action_name)
|
17
|
-
self.class.visible_action?(action_name) && super
|
18
|
-
end
|
19
|
-
|
20
|
-
module ClassMethods
|
21
|
-
# Sets all of the actions passed in as hidden actions.
|
22
|
-
#
|
23
|
-
# ==== Parameters
|
24
|
-
# * <tt>args</tt> - A list of actions
|
25
|
-
def hide_action(*args)
|
26
|
-
self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze
|
27
|
-
end
|
28
|
-
|
29
|
-
def visible_action?(action_name)
|
30
|
-
not hidden_actions.include?(action_name)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Overrides AbstractController::Base#action_methods to remove any methods
|
34
|
-
# that are listed as hidden methods.
|
35
|
-
def action_methods
|
36
|
-
@action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'action_dispatch/http/request'
|
2
|
-
require 'action_dispatch/http/response'
|
3
|
-
|
4
|
-
module ActionController
|
5
|
-
module RackDelegation
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
delegate :headers, :status=, :location=, :content_type=,
|
9
|
-
:status, :location, :content_type, :response_code, :to => "@_response"
|
10
|
-
|
11
|
-
def dispatch(action, request)
|
12
|
-
set_response!(request)
|
13
|
-
super(action, request)
|
14
|
-
end
|
15
|
-
|
16
|
-
def response_body=(body)
|
17
|
-
response.body = body if response
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
|
-
def reset_session
|
22
|
-
@_request.reset_session
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def set_response!(request)
|
28
|
-
@_response = ActionDispatch::Response.new
|
29
|
-
@_response.request = request
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module ActionController
|
2
|
-
class Middleware < Metal
|
3
|
-
class ActionMiddleware
|
4
|
-
def initialize(controller, app)
|
5
|
-
@controller, @app = controller, app
|
6
|
-
end
|
7
|
-
|
8
|
-
def call(env)
|
9
|
-
request = ActionDispatch::Request.new(env)
|
10
|
-
@controller.build(@app).dispatch(:index, request)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class << self
|
15
|
-
alias build new
|
16
|
-
|
17
|
-
def new(app)
|
18
|
-
ActionMiddleware.new(self, app)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
attr_internal :app
|
23
|
-
|
24
|
-
def process(action)
|
25
|
-
response = super
|
26
|
-
self.status, self.headers, self.response_body = response if response.is_a?(Array)
|
27
|
-
response
|
28
|
-
end
|
29
|
-
|
30
|
-
def initialize(app)
|
31
|
-
super()
|
32
|
-
@_app = app
|
33
|
-
end
|
34
|
-
|
35
|
-
def index
|
36
|
-
call(env)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module ActionController
|
2
|
-
module ModelNaming
|
3
|
-
# Converts the given object to an ActiveModel compliant one.
|
4
|
-
def convert_to_model(object)
|
5
|
-
object.respond_to?(:to_model) ? object.to_model : object
|
6
|
-
end
|
7
|
-
|
8
|
-
def model_name_from_record_or_class(record_or_class)
|
9
|
-
convert_to_model(record_or_class).model_name
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|