actionpack 3.0.0.beta → 3.0.0.beta2
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.
- data/CHANGELOG +291 -260
- data/lib/abstract_controller.rb +5 -2
- data/lib/abstract_controller/assigns.rb +21 -0
- data/lib/abstract_controller/base.rb +13 -5
- data/lib/abstract_controller/collector.rb +2 -0
- data/lib/abstract_controller/helpers.rb +4 -14
- data/lib/abstract_controller/layouts.rb +50 -99
- data/lib/abstract_controller/logger.rb +2 -2
- data/lib/abstract_controller/rendering.rb +105 -173
- data/lib/abstract_controller/view_paths.rb +69 -0
- data/lib/action_controller.rb +1 -2
- data/lib/action_controller/base.rb +10 -32
- data/lib/action_controller/caching.rb +19 -18
- data/lib/action_controller/caching/actions.rb +17 -11
- data/lib/action_controller/caching/fragments.rb +5 -17
- data/lib/action_controller/caching/pages.rb +24 -24
- data/lib/action_controller/caching/sweeping.rb +1 -3
- data/lib/action_controller/deprecated.rb +0 -2
- data/lib/action_controller/deprecated/base.rb +143 -0
- data/lib/action_controller/metal.rb +29 -26
- data/lib/action_controller/metal/compatibility.rb +18 -87
- data/lib/action_controller/metal/cookies.rb +0 -1
- data/lib/action_controller/metal/head.rb +1 -0
- data/lib/action_controller/metal/helpers.rb +2 -2
- data/lib/action_controller/metal/hide_actions.rb +4 -6
- data/lib/action_controller/metal/http_authentication.rb +18 -33
- data/lib/action_controller/metal/implicit_render.rb +21 -0
- data/lib/action_controller/metal/instrumentation.rb +1 -1
- data/lib/action_controller/metal/mime_responds.rb +2 -1
- data/lib/action_controller/metal/rack_delegation.rb +3 -8
- data/lib/action_controller/metal/redirecting.rb +2 -1
- data/lib/action_controller/metal/renderers.rb +4 -2
- data/lib/action_controller/metal/rendering.rb +31 -44
- data/lib/action_controller/metal/request_forgery_protection.rb +41 -4
- data/lib/action_controller/metal/responder.rb +2 -0
- data/lib/action_controller/metal/session_management.rb +0 -36
- data/lib/action_controller/metal/streaming.rb +20 -47
- data/lib/action_controller/metal/testing.rb +0 -1
- data/lib/action_controller/metal/url_for.rb +11 -148
- data/lib/action_controller/middleware.rb +2 -1
- data/lib/action_controller/polymorphic_routes.rb +1 -2
- data/lib/action_controller/railtie.rb +63 -10
- data/lib/action_controller/railties/{subscriber.rb → log_subscriber.rb} +5 -12
- data/lib/action_controller/railties/url_helpers.rb +14 -0
- data/lib/action_controller/record_identifier.rb +20 -1
- data/lib/action_controller/test_case.rb +123 -12
- data/lib/action_dispatch.rb +1 -0
- data/lib/action_dispatch/http/cache.rb +20 -3
- data/lib/action_dispatch/http/filter_parameters.rb +40 -25
- data/lib/action_dispatch/http/mime_negotiation.rb +6 -17
- data/lib/action_dispatch/http/mime_type.rb +2 -7
- data/lib/action_dispatch/http/request.rb +12 -33
- data/lib/action_dispatch/http/response.rb +35 -15
- data/lib/action_dispatch/http/upload.rb +2 -0
- data/lib/action_dispatch/http/url.rb +5 -32
- data/lib/action_dispatch/middleware/callbacks.rb +1 -1
- data/lib/action_dispatch/middleware/cookies.rb +4 -3
- data/lib/action_dispatch/middleware/params_parser.rb +4 -3
- data/lib/action_dispatch/middleware/remote_ip.rb +51 -0
- data/lib/action_dispatch/middleware/session/abstract_store.rb +1 -0
- data/lib/action_dispatch/middleware/session/cookie_store.rb +6 -8
- data/lib/action_dispatch/middleware/show_exceptions.rb +0 -14
- data/lib/action_dispatch/middleware/stack.rb +6 -2
- data/lib/action_dispatch/railtie.rb +3 -1
- data/lib/action_dispatch/routing.rb +2 -0
- data/lib/action_dispatch/routing/deprecated_mapper.rb +35 -7
- data/lib/action_dispatch/routing/mapper.rb +134 -48
- data/lib/action_dispatch/routing/route.rb +2 -2
- data/lib/action_dispatch/routing/route_set.rb +217 -158
- data/lib/action_dispatch/routing/url_for.rb +139 -0
- data/lib/action_dispatch/testing/assertions/response.rb +14 -61
- data/lib/action_dispatch/testing/assertions/routing.rb +25 -14
- data/lib/action_dispatch/testing/integration.rb +32 -50
- data/lib/action_dispatch/testing/performance_test.rb +3 -1
- data/lib/action_dispatch/testing/test_process.rb +2 -0
- data/lib/action_dispatch/testing/test_request.rb +2 -0
- data/lib/action_pack/version.rb +4 -3
- data/lib/action_view.rb +11 -6
- data/lib/action_view/base.rb +33 -121
- data/lib/action_view/context.rb +0 -2
- data/lib/action_view/helpers.rb +26 -23
- data/lib/action_view/helpers/active_model_helper.rb +28 -18
- data/lib/action_view/helpers/asset_tag_helper.rb +109 -54
- data/lib/action_view/helpers/atom_feed_helper.rb +2 -2
- data/lib/action_view/helpers/cache_helper.rb +22 -1
- data/lib/action_view/helpers/capture_helper.rb +22 -22
- data/lib/action_view/helpers/date_helper.rb +6 -5
- data/lib/action_view/helpers/form_helper.rb +78 -63
- data/lib/action_view/helpers/form_options_helper.rb +6 -4
- data/lib/action_view/helpers/form_tag_helper.rb +26 -15
- data/lib/action_view/helpers/javascript_helper.rb +90 -10
- data/lib/action_view/helpers/number_helper.rb +315 -118
- data/lib/action_view/helpers/prototype_helper.rb +19 -46
- data/lib/action_view/helpers/record_tag_helper.rb +4 -4
- data/lib/action_view/helpers/tag_helper.rb +7 -24
- data/lib/action_view/helpers/text_helper.rb +8 -7
- data/lib/action_view/helpers/translation_helper.rb +7 -5
- data/lib/action_view/helpers/url_helper.rb +19 -16
- data/lib/action_view/locale/en.yml +45 -6
- data/lib/action_view/lookup_context.rb +190 -0
- data/lib/action_view/paths.rb +22 -63
- data/lib/action_view/railtie.rb +14 -4
- data/lib/action_view/railties/{subscriber.rb → log_subscriber.rb} +1 -1
- data/lib/action_view/render/layouts.rb +73 -0
- data/lib/action_view/render/partials.rb +15 -41
- data/lib/action_view/render/rendering.rb +27 -78
- data/lib/action_view/template.rb +20 -24
- data/lib/action_view/template/error.rb +22 -2
- data/lib/action_view/template/handlers/erb.rb +33 -9
- data/lib/action_view/template/handlers/rjs.rb +1 -2
- data/lib/action_view/template/resolver.rb +46 -104
- data/lib/action_view/template/text.rb +5 -12
- data/lib/action_view/test_case.rb +14 -23
- metadata +83 -40
- data/lib/abstract_controller/compatibility.rb +0 -18
- data/lib/abstract_controller/localized_cache.rb +0 -49
- data/lib/action_controller/metal/configuration.rb +0 -28
- data/lib/action_controller/url_rewriter.rb +0 -76
@@ -1,15 +1,12 @@
|
|
1
1
|
module ActionView #:nodoc:
|
2
2
|
class Template
|
3
3
|
class Text < String #:nodoc:
|
4
|
-
|
4
|
+
attr_accessor :mime_type
|
5
5
|
|
6
|
-
def initialize(string,
|
6
|
+
def initialize(string, mime_type = nil)
|
7
7
|
super(string.to_s)
|
8
|
-
@
|
9
|
-
|
10
|
-
|
11
|
-
def details
|
12
|
-
{:formats => [@content_type.to_sym]}
|
8
|
+
@mime_type = Mime[mime_type] || mime_type if mime_type
|
9
|
+
@mime_type ||= Mime::TEXT
|
13
10
|
end
|
14
11
|
|
15
12
|
def identifier
|
@@ -24,12 +21,8 @@ module ActionView #:nodoc:
|
|
24
21
|
to_s
|
25
22
|
end
|
26
23
|
|
27
|
-
def mime_type
|
28
|
-
@content_type
|
29
|
-
end
|
30
|
-
|
31
24
|
def formats
|
32
|
-
[mime_type]
|
25
|
+
[@mime_type.to_sym]
|
33
26
|
end
|
34
27
|
|
35
28
|
def partial?
|
@@ -1,29 +1,12 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
1
2
|
require 'action_controller/test_case'
|
3
|
+
require 'action_view'
|
2
4
|
|
3
5
|
module ActionView
|
4
|
-
class Base
|
5
|
-
alias_method :initialize_without_template_tracking, :initialize
|
6
|
-
def initialize(*args)
|
7
|
-
@_rendered = { :template => nil, :partials => Hash.new(0) }
|
8
|
-
initialize_without_template_tracking(*args)
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_internal :rendered
|
12
|
-
end
|
13
|
-
|
14
|
-
class Template
|
15
|
-
alias_method :render_without_tracking, :render
|
16
|
-
def render(view, locals, &blk)
|
17
|
-
rendered = view.rendered
|
18
|
-
rendered[:partials][self] += 1 if partial?
|
19
|
-
rendered[:template] ||= []
|
20
|
-
rendered[:template] << self
|
21
|
-
render_without_tracking(view, locals, &blk)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
6
|
class TestCase < ActiveSupport::TestCase
|
26
7
|
class TestController < ActionController::Base
|
8
|
+
include ActionDispatch::TestProcess
|
9
|
+
|
27
10
|
attr_accessor :request, :response, :params
|
28
11
|
|
29
12
|
def self.controller_path
|
@@ -34,11 +17,14 @@ module ActionView
|
|
34
17
|
@request = ActionController::TestRequest.new
|
35
18
|
@response = ActionController::TestResponse.new
|
36
19
|
|
20
|
+
@request.env.delete('PATH_INFO')
|
21
|
+
|
37
22
|
@params = {}
|
38
23
|
end
|
39
24
|
end
|
40
25
|
|
41
26
|
include ActionDispatch::Assertions, ActionDispatch::TestProcess
|
27
|
+
include ActionController::TemplateAssertions
|
42
28
|
include ActionView::Context
|
43
29
|
|
44
30
|
include ActionController::PolymorphicRoutes
|
@@ -60,6 +46,10 @@ module ActionView
|
|
60
46
|
make_test_case_available_to_view!
|
61
47
|
end
|
62
48
|
|
49
|
+
def config
|
50
|
+
@controller.config if @controller.respond_to?(:config)
|
51
|
+
end
|
52
|
+
|
63
53
|
def render(options = {}, local_assigns = {}, &block)
|
64
54
|
@rendered << output = _view.render(options, local_assigns, &block)
|
65
55
|
output
|
@@ -117,7 +107,8 @@ module ActionView
|
|
117
107
|
|
118
108
|
def _view
|
119
109
|
view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
|
120
|
-
view.
|
110
|
+
view.singleton_class.send :include, _helpers
|
111
|
+
view.singleton_class.send :include, @controller._router.url_helpers
|
121
112
|
view.output_buffer = self.output_buffer
|
122
113
|
view
|
123
114
|
end
|
@@ -152,7 +143,7 @@ module ActionView
|
|
152
143
|
end
|
153
144
|
|
154
145
|
def method_missing(selector, *args)
|
155
|
-
if
|
146
|
+
if @controller._router.named_routes.helpers.include?(selector)
|
156
147
|
@controller.__send__(selector, *args)
|
157
148
|
else
|
158
149
|
super
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 3
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- beta2
|
10
|
+
version: 3.0.0.beta2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- David Heinemeier Hansson
|
@@ -9,70 +15,96 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-04-01 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: activesupport
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - "="
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
28
|
+
segments:
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- beta2
|
33
|
+
version: 3.0.0.beta2
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: activemodel
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
40
|
requirements:
|
31
41
|
- - "="
|
32
42
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
43
|
+
segments:
|
44
|
+
- 3
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
- beta2
|
48
|
+
version: 3.0.0.beta2
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
35
51
|
- !ruby/object:Gem::Dependency
|
36
52
|
name: rack
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
55
|
requirements:
|
41
56
|
- - ~>
|
42
57
|
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 1
|
61
|
+
- 0
|
43
62
|
version: 1.1.0
|
44
|
-
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
45
65
|
- !ruby/object:Gem::Dependency
|
46
66
|
name: rack-test
|
47
|
-
|
48
|
-
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
69
|
requirements:
|
51
70
|
- - ~>
|
52
71
|
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 5
|
75
|
+
- 0
|
53
76
|
version: 0.5.0
|
54
|
-
|
77
|
+
type: :runtime
|
78
|
+
version_requirements: *id004
|
55
79
|
- !ruby/object:Gem::Dependency
|
56
80
|
name: rack-mount
|
57
|
-
|
58
|
-
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
prerelease: false
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
60
83
|
requirements:
|
61
84
|
- - ~>
|
62
85
|
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
- 6
|
89
|
+
- 0
|
90
|
+
version: 0.6.0
|
91
|
+
type: :runtime
|
92
|
+
version_requirements: *id005
|
65
93
|
- !ruby/object:Gem::Dependency
|
66
94
|
name: erubis
|
67
|
-
|
68
|
-
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
70
97
|
requirements:
|
71
98
|
- - ~>
|
72
99
|
- !ruby/object:Gem::Version
|
100
|
+
segments:
|
101
|
+
- 2
|
102
|
+
- 6
|
103
|
+
- 5
|
73
104
|
version: 2.6.5
|
74
|
-
|
75
|
-
|
105
|
+
type: :runtime
|
106
|
+
version_requirements: *id006
|
107
|
+
description: Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.
|
76
108
|
email: david@loudthinking.com
|
77
109
|
executables: []
|
78
110
|
|
@@ -84,16 +116,16 @@ files:
|
|
84
116
|
- CHANGELOG
|
85
117
|
- README
|
86
118
|
- MIT-LICENSE
|
119
|
+
- lib/abstract_controller/assigns.rb
|
87
120
|
- lib/abstract_controller/base.rb
|
88
121
|
- lib/abstract_controller/callbacks.rb
|
89
122
|
- lib/abstract_controller/collector.rb
|
90
|
-
- lib/abstract_controller/compatibility.rb
|
91
123
|
- lib/abstract_controller/helpers.rb
|
92
124
|
- lib/abstract_controller/layouts.rb
|
93
|
-
- lib/abstract_controller/localized_cache.rb
|
94
125
|
- lib/abstract_controller/logger.rb
|
95
126
|
- lib/abstract_controller/rendering.rb
|
96
127
|
- lib/abstract_controller/translation.rb
|
128
|
+
- lib/abstract_controller/view_paths.rb
|
97
129
|
- lib/abstract_controller.rb
|
98
130
|
- lib/action_controller/base.rb
|
99
131
|
- lib/action_controller/caching/actions.rb
|
@@ -101,13 +133,13 @@ files:
|
|
101
133
|
- lib/action_controller/caching/pages.rb
|
102
134
|
- lib/action_controller/caching/sweeping.rb
|
103
135
|
- lib/action_controller/caching.rb
|
136
|
+
- lib/action_controller/deprecated/base.rb
|
104
137
|
- lib/action_controller/deprecated/dispatcher.rb
|
105
138
|
- lib/action_controller/deprecated/integration_test.rb
|
106
139
|
- lib/action_controller/deprecated/performance_test.rb
|
107
140
|
- lib/action_controller/deprecated.rb
|
108
141
|
- lib/action_controller/metal/compatibility.rb
|
109
142
|
- lib/action_controller/metal/conditional_get.rb
|
110
|
-
- lib/action_controller/metal/configuration.rb
|
111
143
|
- lib/action_controller/metal/cookies.rb
|
112
144
|
- lib/action_controller/metal/exceptions.rb
|
113
145
|
- lib/action_controller/metal/flash.rb
|
@@ -115,6 +147,7 @@ files:
|
|
115
147
|
- lib/action_controller/metal/helpers.rb
|
116
148
|
- lib/action_controller/metal/hide_actions.rb
|
117
149
|
- lib/action_controller/metal/http_authentication.rb
|
150
|
+
- lib/action_controller/metal/implicit_render.rb
|
118
151
|
- lib/action_controller/metal/instrumentation.rb
|
119
152
|
- lib/action_controller/metal/mime_responds.rb
|
120
153
|
- lib/action_controller/metal/rack_delegation.rb
|
@@ -133,10 +166,10 @@ files:
|
|
133
166
|
- lib/action_controller/middleware.rb
|
134
167
|
- lib/action_controller/polymorphic_routes.rb
|
135
168
|
- lib/action_controller/railtie.rb
|
136
|
-
- lib/action_controller/railties/
|
169
|
+
- lib/action_controller/railties/log_subscriber.rb
|
170
|
+
- lib/action_controller/railties/url_helpers.rb
|
137
171
|
- lib/action_controller/record_identifier.rb
|
138
172
|
- lib/action_controller/test_case.rb
|
139
|
-
- lib/action_controller/url_rewriter.rb
|
140
173
|
- lib/action_controller/vendor/html-scanner/html/document.rb
|
141
174
|
- lib/action_controller/vendor/html-scanner/html/node.rb
|
142
175
|
- lib/action_controller/vendor/html-scanner/html/sanitizer.rb
|
@@ -162,6 +195,7 @@ files:
|
|
162
195
|
- lib/action_dispatch/middleware/flash.rb
|
163
196
|
- lib/action_dispatch/middleware/head.rb
|
164
197
|
- lib/action_dispatch/middleware/params_parser.rb
|
198
|
+
- lib/action_dispatch/middleware/remote_ip.rb
|
165
199
|
- lib/action_dispatch/middleware/rescue.rb
|
166
200
|
- lib/action_dispatch/middleware/session/abstract_store.rb
|
167
201
|
- lib/action_dispatch/middleware/session/cookie_store.rb
|
@@ -182,6 +216,7 @@ files:
|
|
182
216
|
- lib/action_dispatch/routing/mapper.rb
|
183
217
|
- lib/action_dispatch/routing/route.rb
|
184
218
|
- lib/action_dispatch/routing/route_set.rb
|
219
|
+
- lib/action_dispatch/routing/url_for.rb
|
185
220
|
- lib/action_dispatch/routing.rb
|
186
221
|
- lib/action_dispatch/testing/assertions/dom.rb
|
187
222
|
- lib/action_dispatch/testing/assertions/model.rb
|
@@ -225,9 +260,11 @@ files:
|
|
225
260
|
- lib/action_view/helpers/url_helper.rb
|
226
261
|
- lib/action_view/helpers.rb
|
227
262
|
- lib/action_view/locale/en.yml
|
263
|
+
- lib/action_view/lookup_context.rb
|
228
264
|
- lib/action_view/paths.rb
|
229
265
|
- lib/action_view/railtie.rb
|
230
|
-
- lib/action_view/railties/
|
266
|
+
- lib/action_view/railties/log_subscriber.rb
|
267
|
+
- lib/action_view/render/layouts.rb
|
231
268
|
- lib/action_view/render/partials.rb
|
232
269
|
- lib/action_view/render/rendering.rb
|
233
270
|
- lib/action_view/template/error.rb
|
@@ -254,18 +291,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
291
|
requirements:
|
255
292
|
- - ">="
|
256
293
|
- !ruby/object:Gem::Version
|
257
|
-
|
258
|
-
|
294
|
+
segments:
|
295
|
+
- 1
|
296
|
+
- 8
|
297
|
+
- 7
|
298
|
+
version: 1.8.7
|
259
299
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
300
|
requirements:
|
261
301
|
- - ">"
|
262
302
|
- !ruby/object:Gem::Version
|
303
|
+
segments:
|
304
|
+
- 1
|
305
|
+
- 3
|
306
|
+
- 1
|
263
307
|
version: 1.3.1
|
264
|
-
version:
|
265
308
|
requirements:
|
266
309
|
- none
|
267
310
|
rubyforge_project: actionpack
|
268
|
-
rubygems_version: 1.3.
|
311
|
+
rubygems_version: 1.3.6
|
269
312
|
signing_key:
|
270
313
|
specification_version: 3
|
271
314
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module AbstractController
|
2
|
-
module Compatibility
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
def _find_layout(name, details)
|
6
|
-
details[:prefix] = nil if name =~ /\blayouts/
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
# Move this into a "don't run in production" module
|
11
|
-
def _default_layout(details, require_layout = false)
|
12
|
-
super
|
13
|
-
rescue ActionView::MissingTemplate
|
14
|
-
_find_layout(_layout({}), {})
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module AbstractController
|
2
|
-
class HashKey
|
3
|
-
@hash_keys = Hash.new {|h,k| h[k] = Hash.new {|sh,sk| sh[sk] = {} } }
|
4
|
-
|
5
|
-
def self.get(klass, formats, locale)
|
6
|
-
@hash_keys[klass][formats][locale] ||= new(klass, formats, locale)
|
7
|
-
end
|
8
|
-
|
9
|
-
attr_accessor :hash
|
10
|
-
def initialize(klass, formats, locale)
|
11
|
-
@formats, @locale = formats, locale
|
12
|
-
@hash = [formats, locale].hash
|
13
|
-
end
|
14
|
-
|
15
|
-
alias_method :eql?, :equal?
|
16
|
-
|
17
|
-
def inspect
|
18
|
-
"#<HashKey -- formats: #{@formats.inspect} locale: #{@locale.inspect}>"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module LocalizedCache
|
23
|
-
extend ActiveSupport::Concern
|
24
|
-
|
25
|
-
module ClassMethods
|
26
|
-
def clear_template_caches!
|
27
|
-
ActionView::Partials::PartialRenderer::TEMPLATES.clear
|
28
|
-
template_cache.clear
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def template_cache
|
33
|
-
@template_cache ||= Hash.new {|h,k| h[k] = {} }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def render(*args)
|
38
|
-
Thread.current[:format_locale_key] = HashKey.get(self.class, formats, I18n.locale)
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def with_template_cache(name)
|
45
|
-
self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module ActionController
|
2
|
-
module Configuration
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
def config
|
6
|
-
@config ||= self.class.config
|
7
|
-
end
|
8
|
-
|
9
|
-
def config=(config)
|
10
|
-
@config = config
|
11
|
-
end
|
12
|
-
|
13
|
-
module ClassMethods
|
14
|
-
def default_config
|
15
|
-
@default_config ||= {}
|
16
|
-
end
|
17
|
-
|
18
|
-
def config
|
19
|
-
self.config ||= default_config
|
20
|
-
end
|
21
|
-
|
22
|
-
def config=(config)
|
23
|
-
@config = ActiveSupport::OrderedHash.new
|
24
|
-
@config.merge!(config)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|