actionpack 3.2.2 → 3.2.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.

@@ -1,4 +1,26 @@
1
- ## Rails 3.2.2 (unreleased) ##
1
+ ## Rails 3.2.3 (unreleased) ##
2
+
3
+ * Do not include the authenticity token in forms where remote: true as ajax forms use the meta-tag value *DHH*
4
+
5
+ * Turn off verbose mode of rack-cache, we still have X-Rack-Cache to
6
+ check that info. Closes #5245. *Santiago Pastorino*
7
+
8
+ * Fix #5238, rendered_format is not set when template is not rendered. *Piotr Sarnacki*
9
+
10
+ * Upgrade rack-cache to 1.2. *José Valim*
11
+
12
+ * ActionController::SessionManagement is deprecated. *Santiago Pastorino*
13
+
14
+ * Since the router holds references to many parts of the system like engines, controllers and the application itself, inspecting the route set can actually be really slow, therefore we default alias inspect to to_s. *José Valim*
15
+
16
+ * Add a new line after the textarea opening tag. Closes #393 *Rafael Mendonça França*
17
+
18
+ * Always pass a respond block from to responder. We should let the responder to decide what to do with the given overridden response block, and not short circuit it. *sikachu*
19
+
20
+ * Fixes layout rendering regression from 3.2.2. *José Valim*
21
+
22
+
23
+ ## Rails 3.2.2 (March 1, 2012) ##
2
24
 
3
25
  * Format lookup for partials is derived from the format in which the template is being rendered. Closes #5025 part 2 *Santiago Pastorino*
4
26
 
@@ -10,6 +32,7 @@
10
32
  This is a behavior change, previously the hidden tag had a value of the disabled checkbox.
11
33
  *Tadas Tamosauskas*
12
34
 
35
+
13
36
  ## Rails 3.2.1 (January 26, 2012) ##
14
37
 
15
38
  * Documentation improvements.
@@ -237,8 +237,7 @@ module AbstractController
237
237
  #
238
238
  # If the specified layout is a:
239
239
  # String:: the String is the template name
240
- # Symbol:: call the method specified by the symbol, which will return
241
- # the template name
240
+ # Symbol:: call the method specified by the symbol, which will return the template name
242
241
  # false:: There is no layout
243
242
  # true:: raise an ArgumentError
244
243
  # nil:: Force default layout behavior with inheritance
@@ -106,6 +106,7 @@ module AbstractController
106
106
  # Find and renders a template based on the options given.
107
107
  # :api: private
108
108
  def _render_template(options) #:nodoc:
109
+ lookup_context.rendered_format = nil if options[:formats]
109
110
  view_renderer.render(view_context, options)
110
111
  end
111
112
 
@@ -192,7 +192,6 @@ module ActionController
192
192
  Renderers::All,
193
193
  ConditionalGet,
194
194
  RackDelegation,
195
- SessionManagement,
196
195
  Caching,
197
196
  MimeResponds,
198
197
  ImplicitRender,
@@ -235,16 +235,8 @@ module ActionController #:nodoc:
235
235
 
236
236
  if collector = retrieve_collector_from_mimes(&block)
237
237
  options = resources.size == 1 ? {} : resources.extract_options!
238
-
239
- if defined_response = collector.response
240
- if action = options.delete(:action)
241
- render :action => action
242
- else
243
- defined_response.call
244
- end
245
- else
246
- (options.delete(:responder) || self.class.responder).call(self, resources, options)
247
- end
238
+ options[:default_response] = collector.response
239
+ (options.delete(:responder) || self.class.responder).call(self, resources, options)
248
240
  end
249
241
  end
250
242
 
@@ -281,6 +273,7 @@ module ActionController #:nodoc:
281
273
  if format
282
274
  self.content_type ||= format.to_s
283
275
  lookup_context.formats = [format.to_sym]
276
+ lookup_context.rendered_format = lookup_context.formats.first
284
277
  collector
285
278
  else
286
279
  head :not_acceptable
@@ -93,7 +93,7 @@ module ActionController
93
93
  _compute_redirect_to_location options.call
94
94
  else
95
95
  url_for(options)
96
- end.gsub(/[\r\n]/, '')
96
+ end.gsub(/[\0\r\n]/, '')
97
97
  end
98
98
  end
99
99
  end
@@ -129,6 +129,7 @@ module ActionController #:nodoc:
129
129
  @resources = resources
130
130
  @options = options
131
131
  @action = options.delete(:action)
132
+ @default_response = options.delete(:default_response)
132
133
  end
133
134
 
134
135
  delegate :head, :render, :redirect_to, :to => :controller
@@ -171,7 +172,7 @@ module ActionController #:nodoc:
171
172
  # responds to :to_format and display it.
172
173
  #
173
174
  def to_format
174
- if get? || !has_errors?
175
+ if get? || !has_errors? || response_overridden?
175
176
  default_render
176
177
  else
177
178
  display_errors
@@ -225,7 +226,11 @@ module ActionController #:nodoc:
225
226
  # controller.
226
227
  #
227
228
  def default_render
228
- controller.default_render(options)
229
+ if @default_response
230
+ @default_response.call(options)
231
+ else
232
+ controller.default_render(options)
233
+ end
229
234
  end
230
235
 
231
236
  # Display is just a shortcut to render a resource with the current format.
@@ -273,5 +278,9 @@ module ActionController #:nodoc:
273
278
  def json_resource_errors
274
279
  {:errors => resource.errors}
275
280
  end
281
+
282
+ def response_overridden?
283
+ @default_response.present?
284
+ end
276
285
  end
277
286
  end
@@ -2,6 +2,11 @@ module ActionController #:nodoc:
2
2
  module SessionManagement #:nodoc:
3
3
  extend ActiveSupport::Concern
4
4
 
5
+ included do
6
+ ActiveSupport::Deprecation.warn "ActionController::SessionManagement " \
7
+ "is deprecated because it has no contents since Rails 3.1", caller
8
+ end
9
+
5
10
  module ClassMethods
6
11
 
7
12
  end
@@ -457,7 +457,6 @@ module ActionController
457
457
  @request.session["flash"].sweep
458
458
 
459
459
  @controller.request = @request
460
- @controller.params.merge!(parameters)
461
460
  build_request_uri(action, parameters)
462
461
  @controller.class.class_eval { include Testing }
463
462
  @controller.recycle!
@@ -483,11 +482,6 @@ module ActionController
483
482
  end
484
483
  end
485
484
 
486
- # Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local
487
- def rescue_action_in_public!
488
- @request.remote_addr = '208.77.188.166' # example.com
489
- end
490
-
491
485
  included do
492
486
  include ActionController::TemplateAssertions
493
487
  include ActionDispatch::Assertions
@@ -59,7 +59,7 @@ module ActionDispatch
59
59
  end
60
60
 
61
61
  def set_session(env, sid, session_data, options)
62
- session_data.merge("session_id" => sid)
62
+ session_data.merge!("session_id" => sid)
63
63
  end
64
64
 
65
65
  def set_cookie(env, session_id, cookie)
@@ -38,6 +38,7 @@ module ActionDispatch
38
38
  end
39
39
 
40
40
  def escape_glob_chars(path)
41
+ path.force_encoding('binary') if path.respond_to? :force_encoding
41
42
  path.gsub(/[*?{}\[\]]/, "\\\\\\&")
42
43
  end
43
44
  end
@@ -16,7 +16,7 @@ module ActionDispatch
16
16
  config.action_dispatch.rack_cache = {
17
17
  :metastore => "rails:/",
18
18
  :entitystore => "rails:/",
19
- :verbose => true
19
+ :verbose => false
20
20
  }
21
21
 
22
22
  initializer "action_dispatch.configure" do |app|
@@ -325,7 +325,7 @@ module ActionDispatch
325
325
  # +call+ or a string representing a controller's action.
326
326
  #
327
327
  # match 'path', :to => 'controller#action'
328
- # match 'path', :to => lambda { [200, {}, "Success!"] }
328
+ # match 'path', :to => lambda { |env| [200, {}, "Success!"] }
329
329
  # match 'path', :to => RackApp
330
330
  #
331
331
  # [:on]
@@ -9,6 +9,12 @@ require 'action_controller/metal/exceptions'
9
9
  module ActionDispatch
10
10
  module Routing
11
11
  class RouteSet #:nodoc:
12
+ # Since the router holds references to many parts of the system
13
+ # like engines, controllers and the application itself, inspecting
14
+ # the route set can actually be really slow, therefore we default
15
+ # alias inspect to to_s.
16
+ alias inspect to_s
17
+
12
18
  PARAMETERS_KEY = 'action_dispatch.request.path_parameters'
13
19
 
14
20
  class Dispatcher #:nodoc:
@@ -83,7 +83,7 @@ module ActionDispatch
83
83
  refer
84
84
  else
85
85
  @controller.url_for(fragment)
86
- end.gsub(/[\r\n]/, '')
86
+ end.gsub(/[\0\r\n]/, '')
87
87
  end
88
88
 
89
89
  def validate_request!
@@ -2,8 +2,8 @@ module ActionPack
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 2
6
- PRE = nil
5
+ TINY = 3
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -940,7 +940,10 @@ module ActionView
940
940
  # Returns the id attribute for the input tag.
941
941
  # => "post_written_on_1i"
942
942
  def input_id_from_type(type)
943
- input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '')
943
+ id = input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '')
944
+ id = @options[:namespace] + '_' + id if @options[:namespace]
945
+
946
+ id
944
947
  end
945
948
 
946
949
  # Given an ordering of datetime components, create the selection HTML
@@ -1072,7 +1072,7 @@ module ActionView
1072
1072
  options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
1073
1073
  end
1074
1074
 
1075
- content_tag("textarea", ERB::Util.html_escape(options.delete('value') || value_before_type_cast(object)), options)
1075
+ content_tag("textarea", "\n#{options.delete('value') || value_before_type_cast(object)}", options)
1076
1076
  end
1077
1077
 
1078
1078
  def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
@@ -27,7 +27,9 @@ module ActionView
27
27
  # is added to simulate the verb over post.
28
28
  # * <tt>:authenticity_token</tt> - Authenticity token to use in the form. Use only if you need to
29
29
  # pass custom authenticity token string, or to not add authenticity_token field at all
30
- # (by passing <tt>false</tt>).
30
+ # (by passing <tt>false</tt>). If this is a remote form, the authenticity_token will by default
31
+ # not be included as the ajax handler will get it from the meta-tag (but you can force it to be
32
+ # rendered anyway in that case by passing <tt>true</tt>).
31
33
  # * A list of parameters to feed to the URL the form will be posted to.
32
34
  # * <tt>:remote</tt> - If set to true, will allow the Unobtrusive JavaScript drivers to control the
33
35
  # submit behavior. By default this behavior is an ajax submit.
@@ -609,8 +611,17 @@ module ActionView
609
611
  # responsibility of the caller to escape all the values.
610
612
  html_options["action"] = url_for(url_for_options)
611
613
  html_options["accept-charset"] = "UTF-8"
614
+
612
615
  html_options["data-remote"] = true if html_options.delete("remote")
613
- html_options["authenticity_token"] = html_options.delete("authenticity_token") if html_options.has_key?("authenticity_token")
616
+
617
+ if html_options["data-remote"] && html_options["authenticity_token"] == true
618
+ # Include the default authenticity_token, which is only generated when its set to nil,
619
+ # but we needed the true value to override the default of no authenticity_token on data-remote.
620
+ html_options["authenticity_token"] = nil
621
+ elsif html_options["data-remote"]
622
+ # The authenticity token is taken from the meta tag in this case
623
+ html_options["authenticity_token"] = false
624
+ end
614
625
  end
615
626
  end
616
627
 
@@ -221,6 +221,14 @@ module ActionView
221
221
  setup(context, options, block)
222
222
  identifier = (@template = find_partial) ? @template.identifier : @path
223
223
 
224
+ @lookup_context.rendered_format ||= begin
225
+ if @template && @template.formats.present?
226
+ @template.formats.first
227
+ else
228
+ formats.first
229
+ end
230
+ end
231
+
224
232
  if @collection
225
233
  instrument(:collection, :identifier => identifier || "collection", :count => @collection.size) do
226
234
  render_collection
@@ -8,8 +8,13 @@ module ActionView
8
8
  @details = extract_details(options)
9
9
  extract_format(options[:file] || options[:template], @details)
10
10
  template = determine_template(options)
11
- @lookup_context.rendered_format ||= template.formats.first
12
- @lookup_context.formats = template.formats
11
+ context = @lookup_context
12
+
13
+ unless context.rendered_format
14
+ context.rendered_format = template.formats.first
15
+ context.formats = template.formats
16
+ end
17
+
13
18
  render_template(template, options[:layout], options[:locals])
14
19
  end
15
20
 
@@ -81,7 +81,7 @@ module Sprockets
81
81
  private
82
82
  def debug_assets?
83
83
  compile_assets? && (Rails.application.config.assets.debug || params[:debug_assets])
84
- rescue NoMethodError
84
+ rescue NameError
85
85
  false
86
86
  end
87
87
 
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease:
4
+ hash: 15424079
5
+ prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 2
10
- version: 3.2.2
9
+ - 3
10
+ - rc
11
+ - 1
12
+ version: 3.2.3.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - David Heinemeier Hansson
@@ -15,59 +17,62 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-03-01 00:00:00 Z
20
+ date: 2012-03-27 00:00:00 -03:00
21
+ default_executable:
19
22
  dependencies:
20
23
  - !ruby/object:Gem::Dependency
21
- name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - "="
27
28
  - !ruby/object:Gem::Version
28
- hash: 11
29
+ hash: 15424079
29
30
  segments:
30
31
  - 3
31
32
  - 2
32
- - 2
33
- version: 3.2.2
33
+ - 3
34
+ - rc
35
+ - 1
36
+ version: 3.2.3.rc1
37
+ requirement: *id001
34
38
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: activemodel
39
+ name: activesupport
38
40
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
41
+ - !ruby/object:Gem::Dependency
42
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
43
  none: false
41
44
  requirements:
42
45
  - - "="
43
46
  - !ruby/object:Gem::Version
44
- hash: 11
47
+ hash: 15424079
45
48
  segments:
46
49
  - 3
47
50
  - 2
48
- - 2
49
- version: 3.2.2
51
+ - 3
52
+ - rc
53
+ - 1
54
+ version: 3.2.3.rc1
55
+ requirement: *id002
50
56
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rack-cache
57
+ name: activemodel
54
58
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
59
+ - !ruby/object:Gem::Dependency
60
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
61
  none: false
57
62
  requirements:
58
63
  - - ~>
59
64
  - !ruby/object:Gem::Version
60
- hash: 13
65
+ hash: 11
61
66
  segments:
62
67
  - 1
63
- - 1
64
- version: "1.1"
68
+ - 2
69
+ version: "1.2"
70
+ requirement: *id003
65
71
  type: :runtime
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: builder
72
+ name: rack-cache
69
73
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
74
+ - !ruby/object:Gem::Dependency
75
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
76
  none: false
72
77
  requirements:
73
78
  - - ~>
@@ -78,12 +83,12 @@ dependencies:
78
83
  - 0
79
84
  - 0
80
85
  version: 3.0.0
86
+ requirement: *id004
81
87
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: rack
88
+ name: builder
85
89
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
90
+ - !ruby/object:Gem::Dependency
91
+ version_requirements: &id005 !ruby/object:Gem::Requirement
87
92
  none: false
88
93
  requirements:
89
94
  - - ~>
@@ -94,12 +99,12 @@ dependencies:
94
99
  - 4
95
100
  - 0
96
101
  version: 1.4.0
102
+ requirement: *id005
97
103
  type: :runtime
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: rack-test
104
+ name: rack
101
105
  prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
106
+ - !ruby/object:Gem::Dependency
107
+ version_requirements: &id006 !ruby/object:Gem::Requirement
103
108
  none: false
104
109
  requirements:
105
110
  - - ~>
@@ -110,12 +115,12 @@ dependencies:
110
115
  - 6
111
116
  - 1
112
117
  version: 0.6.1
118
+ requirement: *id006
113
119
  type: :runtime
114
- version_requirements: *id006
115
- - !ruby/object:Gem::Dependency
116
- name: journey
120
+ name: rack-test
117
121
  prerelease: false
118
- requirement: &id007 !ruby/object:Gem::Requirement
122
+ - !ruby/object:Gem::Dependency
123
+ version_requirements: &id007 !ruby/object:Gem::Requirement
119
124
  none: false
120
125
  requirements:
121
126
  - - ~>
@@ -126,12 +131,12 @@ dependencies:
126
131
  - 0
127
132
  - 1
128
133
  version: 1.0.1
134
+ requirement: *id007
129
135
  type: :runtime
130
- version_requirements: *id007
131
- - !ruby/object:Gem::Dependency
132
- name: sprockets
136
+ name: journey
133
137
  prerelease: false
134
- requirement: &id008 !ruby/object:Gem::Requirement
138
+ - !ruby/object:Gem::Dependency
139
+ version_requirements: &id008 !ruby/object:Gem::Requirement
135
140
  none: false
136
141
  requirements:
137
142
  - - ~>
@@ -142,12 +147,12 @@ dependencies:
142
147
  - 1
143
148
  - 2
144
149
  version: 2.1.2
150
+ requirement: *id008
145
151
  type: :runtime
146
- version_requirements: *id008
147
- - !ruby/object:Gem::Dependency
148
- name: erubis
152
+ name: sprockets
149
153
  prerelease: false
150
- requirement: &id009 !ruby/object:Gem::Requirement
154
+ - !ruby/object:Gem::Dependency
155
+ version_requirements: &id009 !ruby/object:Gem::Requirement
151
156
  none: false
152
157
  requirements:
153
158
  - - ~>
@@ -158,12 +163,12 @@ dependencies:
158
163
  - 7
159
164
  - 0
160
165
  version: 2.7.0
166
+ requirement: *id009
161
167
  type: :runtime
162
- version_requirements: *id009
163
- - !ruby/object:Gem::Dependency
164
- name: tzinfo
168
+ name: erubis
165
169
  prerelease: false
166
- requirement: &id010 !ruby/object:Gem::Requirement
170
+ - !ruby/object:Gem::Dependency
171
+ version_requirements: &id010 !ruby/object:Gem::Requirement
167
172
  none: false
168
173
  requirements:
169
174
  - - ~>
@@ -174,8 +179,10 @@ dependencies:
174
179
  - 3
175
180
  - 29
176
181
  version: 0.3.29
182
+ requirement: *id010
177
183
  type: :development
178
- version_requirements: *id010
184
+ name: tzinfo
185
+ prerelease: false
179
186
  description: Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.
180
187
  email: david@loudthinking.com
181
188
  executables: []
@@ -376,6 +383,7 @@ files:
376
383
  - lib/sprockets/helpers.rb
377
384
  - lib/sprockets/railtie.rb
378
385
  - lib/sprockets/static_compiler.rb
386
+ has_rdoc: true
379
387
  homepage: http://www.rubyonrails.org
380
388
  licenses: []
381
389
 
@@ -398,16 +406,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
398
406
  required_rubygems_version: !ruby/object:Gem::Requirement
399
407
  none: false
400
408
  requirements:
401
- - - ">="
409
+ - - ">"
402
410
  - !ruby/object:Gem::Version
403
- hash: 3
411
+ hash: 25
404
412
  segments:
405
- - 0
406
- version: "0"
413
+ - 1
414
+ - 3
415
+ - 1
416
+ version: 1.3.1
407
417
  requirements:
408
418
  - none
409
419
  rubyforge_project:
410
- rubygems_version: 1.8.16
420
+ rubygems_version: 1.3.7
411
421
  signing_key:
412
422
  specification_version: 3
413
423
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).