actionpack 3.1.2 → 3.1.3

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,12 @@
1
+ ## Rails 3.1.3 (unreleased) ##
2
+
3
+ * Downgrade sprockets to ~> 2.0.3. Using 2.1.0 caused regressions.
4
+
5
+ * Fix using `tranlate` helper with a html translation which uses the `:count` option for
6
+ pluralization.
7
+
8
+ *Jon Leighton*
9
+
1
10
  ## Rails 3.1.2 (unreleased) ##
2
11
 
3
12
  * Fix XSS security vulnerability in the `translate` helper method. When using interpolation
@@ -2,7 +2,7 @@ module ActionPack
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 3
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -983,8 +983,16 @@ module ActionView
983
983
  label_tag(name_and_id["id"], options, &block)
984
984
  else
985
985
  content = if text.blank?
986
+ object_name.gsub!(/\[(.*)_attributes\]\[\d\]/, '.\1')
986
987
  method_and_value = tag_value.present? ? "#{method_name}.#{tag_value}" : method_name
987
- I18n.t("helpers.label.#{object_name}.#{method_and_value}", :default => "").presence
988
+
989
+ if object.respond_to?(:to_model)
990
+ key = object.class.model_name.i18n_key
991
+ i18n_default = ["#{key}.#{method_and_value}".to_sym, ""]
992
+ end
993
+
994
+ i18n_default ||= ""
995
+ I18n.t("#{object_name}.#{method_and_value}", :default => i18n_default, :scope => "helpers.label").presence
988
996
  else
989
997
  text.to_s
990
998
  end
@@ -48,7 +48,9 @@ module ActionView
48
48
  if html_safe_translation_key?(key)
49
49
  html_safe_options = options.dup
50
50
  options.except(*I18n::RESERVED_KEYS).each do |name, value|
51
- html_safe_options[name] = ERB::Util.html_escape(value.to_s)
51
+ unless name == :count && value.is_a?(Numeric)
52
+ html_safe_options[name] = ERB::Util.html_escape(value.to_s)
53
+ end
52
54
  end
53
55
  translation = I18n.translate(scope_key_by_partial(key), html_safe_options)
54
56
 
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 2
10
- version: 3.1.2
9
+ - 3
10
+ version: 3.1.3
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: 2011-11-18 00:00:00 Z
18
+ date: 2011-11-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 7
29
+ hash: 5
30
30
  segments:
31
31
  - 3
32
32
  - 1
33
- - 2
34
- version: 3.1.2
33
+ - 3
34
+ version: 3.1.3
35
35
  requirement: *id001
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activemodel
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - "="
44
44
  - !ruby/object:Gem::Version
45
- hash: 7
45
+ hash: 5
46
46
  segments:
47
47
  - 3
48
48
  - 1
49
- - 2
50
- version: 3.1.2
49
+ - 3
50
+ version: 3.1.3
51
51
  requirement: *id002
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: rack-cache
@@ -152,12 +152,12 @@ dependencies:
152
152
  requirements:
153
153
  - - ~>
154
154
  - !ruby/object:Gem::Version
155
- hash: 11
155
+ hash: 9
156
156
  segments:
157
157
  - 2
158
- - 1
159
158
  - 0
160
- version: 2.1.0
159
+ - 3
160
+ version: 2.0.3
161
161
  requirement: *id009
162
162
  - !ruby/object:Gem::Dependency
163
163
  name: erubis