actionpack 3.2.5 → 3.2.6

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,3 +1,23 @@
1
+ ## Rails 3.2.6 (Jun 12, 2012) ##
2
+
3
+ * nil is removed from array parameter values
4
+
5
+ CVE-2012-2694
6
+
7
+ * Deprecate `:confirm` in favor of `':data => { :confirm => "Text" }'` option for `button_to`, `button_tag`, `image_submit_tag`, `link_to` and `submit_tag` helpers.
8
+
9
+ *Carlos Galdino*
10
+
11
+ * Allow to use mounted_helpers (helpers for accessing mounted engines) in ActionView::TestCase. *Piotr Sarnacki*
12
+
13
+ * Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. *Piotr Sarnacki*
14
+
15
+
16
+ ## Rails 3.2.5 (Jun 1, 2012) ##
17
+
18
+ * No changes.
19
+
20
+
1
21
  ## Rails 3.2.4 (May 31, 2012) ##
2
22
 
3
23
  * Deprecate old APIs for highlight, excerpt and word_wrap *Jeremy Walker*
@@ -24,6 +44,7 @@
24
44
  * Strip [nil] from parameters hash. Thanks to Ben Murphy for
25
45
  reporting this! CVE-2012-2660
26
46
 
47
+
27
48
  ## Rails 3.2.3 (March 30, 2012) ##
28
49
 
29
50
  * Allow to lazy load `default_form_builder` by passing a `String` instead of a constant. *Piotr Sarnacki*
@@ -460,6 +460,7 @@ module ActionController
460
460
 
461
461
  @request.session = ActionController::TestSession.new(session) if session
462
462
  @request.session["flash"] = @request.flash.update(flash || {})
463
+ @request.session["flash"].sweep
463
464
 
464
465
  @controller.request = @request
465
466
  build_request_uri(action, parameters)
@@ -251,17 +251,19 @@ module ActionDispatch
251
251
 
252
252
  # Remove nils from the params hash
253
253
  def deep_munge(hash)
254
+ keys = hash.keys.find_all { |k| hash[k] == [nil] }
255
+ keys.each { |k| hash[k] = nil }
256
+
254
257
  hash.each_value do |v|
255
258
  case v
256
259
  when Array
257
260
  v.grep(Hash) { |x| deep_munge(x) }
261
+ v.compact!
258
262
  when Hash
259
263
  deep_munge(v)
260
264
  end
261
265
  end
262
266
 
263
- keys = hash.keys.find_all { |k| hash[k] == [nil] }
264
- keys.each { |k| hash[k] = nil }
265
267
  hash
266
268
  end
267
269
 
@@ -4,7 +4,7 @@ module ActionDispatch
4
4
  # read a notice you put there or <tt>flash["notice"] = "hello"</tt>
5
5
  # to put a new one.
6
6
  def flash
7
- @env[Flash::KEY] ||= (session["flash"] || Flash::FlashHash.new).tap(&:sweep)
7
+ @env[Flash::KEY] ||= (session["flash"] || Flash::FlashHash.new)
8
8
  end
9
9
  end
10
10
 
@@ -235,6 +235,10 @@ module ActionDispatch
235
235
  end
236
236
 
237
237
  def call(env)
238
+ if (session = env['rack.session']) && (flash = session['flash'])
239
+ flash.sweep
240
+ end
241
+
238
242
  @app.call(env)
239
243
  ensure
240
244
  session = env['rack.session'] || {}
@@ -251,8 +255,7 @@ module ActionDispatch
251
255
  env[KEY] = new_hash
252
256
  end
253
257
 
254
- if (!session.respond_to?(:loaded?) || session.loaded?) && # (reset_session uses {}, which doesn't implement #loaded?)
255
- session.key?('flash') && session['flash'].empty?
258
+ if session.key?('flash') && session['flash'].empty?
256
259
  session.delete('flash')
257
260
  end
258
261
  end
@@ -97,7 +97,7 @@ module ActionDispatch
97
97
  end
98
98
 
99
99
  record = extract_record(record_or_hash_or_array)
100
- record = record.to_model if record.respond_to?(:to_model)
100
+ record = convert_to_model(record)
101
101
 
102
102
  args = Array === record_or_hash_or_array ?
103
103
  record_or_hash_or_array.dup :
@@ -124,6 +124,8 @@ module ActionDispatch
124
124
  args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
125
125
  end
126
126
 
127
+ args.collect! { |a| convert_to_model(a) }
128
+
127
129
  (proxy || self).send(named_route, *args)
128
130
  end
129
131
 
@@ -154,6 +156,10 @@ module ActionDispatch
154
156
  options[:action] ? "#{options[:action]}_" : ''
155
157
  end
156
158
 
159
+ def convert_to_model(object)
160
+ object.respond_to?(:to_model) ? object.to_model : object
161
+ end
162
+
157
163
  def routing_type(options)
158
164
  options[:routing_type] || :url
159
165
  end
@@ -177,8 +177,11 @@ module ActionDispatch
177
177
 
178
178
  # If the app is a Rails app, make url_helpers available on the session
179
179
  # This makes app.url_for and app.foo_path available in the console
180
- if app.respond_to?(:routes) && app.routes.respond_to?(:url_helpers)
181
- singleton_class.class_eval { include app.routes.url_helpers }
180
+ if app.respond_to?(:routes)
181
+ singleton_class.class_eval do
182
+ include app.routes.url_helpers if app.routes.respond_to?(:url_helpers)
183
+ include app.routes.mounted_helpers if app.routes.respond_to?(:mounted_helpers)
184
+ end
182
185
  end
183
186
 
184
187
  reset!
@@ -2,7 +2,7 @@ module ActionPack
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 5
5
+ TINY = 6
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -423,6 +423,8 @@ module ActionView
423
423
  end
424
424
 
425
425
  if confirm = options.delete("confirm")
426
+ ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => \'Text\' }' instead"
427
+
426
428
  options["data-confirm"] = confirm
427
429
  end
428
430
 
@@ -475,6 +477,8 @@ module ActionView
475
477
  end
476
478
 
477
479
  if confirm = options.delete("confirm")
480
+ ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => \'Text\' }' instead"
481
+
478
482
  options["data-confirm"] = confirm
479
483
  end
480
484
 
@@ -510,6 +514,8 @@ module ActionView
510
514
  options = options.stringify_keys
511
515
 
512
516
  if confirm = options.delete("confirm")
517
+ ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => \'Text\' }' instead"
518
+
513
519
  options["data-confirm"] = confirm
514
520
  end
515
521
 
@@ -628,8 +628,13 @@ module ActionView
628
628
  html_options["data-disable-with"] = disable_with
629
629
  end
630
630
 
631
- html_options["data-confirm"] = confirm if confirm
632
- add_method_to_attributes!(html_options, method) if method
631
+ if confirm
632
+ ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => \'Text\' }' instead"
633
+
634
+ html_options["data-confirm"] = confirm
635
+ end
636
+
637
+ add_method_to_attributes!(html_options, method) if method
633
638
 
634
639
  html_options
635
640
  else
@@ -229,7 +229,8 @@ module ActionView
229
229
 
230
230
  def method_missing(selector, *args)
231
231
  if @controller.respond_to?(:_routes) &&
232
- @controller._routes.named_routes.helpers.include?(selector)
232
+ ( @controller._routes.named_routes.helpers.include?(selector) ||
233
+ @controller._routes.mounted_helpers.method_defined?(selector) )
233
234
  @controller.__send__(selector, *args)
234
235
  else
235
236
  super
@@ -157,7 +157,8 @@ module Sprockets
157
157
  def rewrite_extension(source, dir, ext)
158
158
  source_ext = File.extname(source)
159
159
  if ext && source_ext != ".#{ext}"
160
- if !source_ext.empty? && asset_environment[source]
160
+ if !source_ext.empty? && (asset = asset_environment[source]) &&
161
+ asset.pathname.to_s =~ /#{source}\Z/
161
162
  source
162
163
  else
163
164
  "#{source}.#{ext}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 5
10
- version: 3.2.5
9
+ - 6
10
+ version: 3.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heinemeier Hansson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-01 00:00:00 Z
18
+ date: 2012-06-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -25,12 +25,12 @@ dependencies:
25
25
  requirements:
26
26
  - - "="
27
27
  - !ruby/object:Gem::Version
28
- hash: 5
28
+ hash: 3
29
29
  segments:
30
30
  - 3
31
31
  - 2
32
- - 5
33
- version: 3.2.5
32
+ - 6
33
+ version: 3.2.6
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - "="
43
43
  - !ruby/object:Gem::Version
44
- hash: 5
44
+ hash: 3
45
45
  segments:
46
46
  - 3
47
47
  - 2
48
- - 5
49
- version: 3.2.5
48
+ - 6
49
+ version: 3.2.6
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency