actionpack 3.0.5 → 3.0.6.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.
- data/CHANGELOG +29 -0
- data/lib/abstract_controller/callbacks.rb +1 -1
- data/lib/action_controller/caching/actions.rb +5 -3
- data/lib/action_dispatch/http/filter_parameters.rb +17 -4
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +1 -1
- data/lib/action_dispatch/routing/route_set.rb +2 -1
- data/lib/action_pack/version.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +1 -1
- data/lib/action_view/helpers/number_helper.rb +1 -1
- data/lib/action_view/helpers/prototype_helper.rb +0 -1
- data/lib/action_view/helpers/translation_helper.rb +25 -7
- metadata +31 -22
data/CHANGELOG
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
*Rails 3.0.6 (unreleased)*
|
2
|
+
|
3
|
+
* Fixes the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default [Prem Sichanugrist]
|
4
|
+
|
5
|
+
* Fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [Josh Kalderimis]
|
6
|
+
|
7
|
+
* Sensitive query string parameters (specified in config.filter_parameters) will now be filtered out from the request paths in the log file. [Prem Sichanugrist, fxn]
|
8
|
+
|
9
|
+
* URL parameters which return nil for to_param are now removed from the query string [Andrew White]
|
10
|
+
|
11
|
+
* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 [Santiago Pastorino]
|
12
|
+
|
13
|
+
* Make TranslationHelper#translate use the :rescue_format option in I18n 0.5.0 [Sven Fuchs]
|
14
|
+
|
15
|
+
* Fix regression: javascript_include_tag shouldn't raise if you register an expansion key with nil or [] value [Santiago Pastorino]
|
16
|
+
|
17
|
+
* Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body. [Cheah Chu Yeow]
|
18
|
+
|
19
|
+
|
20
|
+
*Rails 3.0.5 (February 26, 2011)*
|
21
|
+
|
22
|
+
* No changes.
|
23
|
+
|
24
|
+
|
25
|
+
*Rails 3.0.4 (February 8, 2011)*
|
26
|
+
|
27
|
+
* No changes.
|
28
|
+
|
29
|
+
|
1
30
|
*Rails 3.0.3 (November 16, 2010)*
|
2
31
|
|
3
32
|
* When ActiveRecord::Base objects are sent to predicate methods, the id of the object should be sent to ARel, not the ActiveRecord::Base object.
|
@@ -14,7 +14,7 @@ module AbstractController
|
|
14
14
|
# Override AbstractController::Base's process_action to run the
|
15
15
|
# process_action callbacks around the normal behavior.
|
16
16
|
def process_action(method_name, *args)
|
17
|
-
run_callbacks(:process_action,
|
17
|
+
run_callbacks(:process_action, action_name) do
|
18
18
|
super
|
19
19
|
end
|
20
20
|
end
|
@@ -103,12 +103,14 @@ module ActionController #:nodoc:
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def _save_fragment(name, options)
|
106
|
-
return unless caching_allowed?
|
107
|
-
|
108
106
|
content = response_body
|
109
107
|
content = content.join if content.is_a?(Array)
|
110
108
|
|
111
|
-
|
109
|
+
if caching_allowed?
|
110
|
+
write_fragment(name, content, options)
|
111
|
+
else
|
112
|
+
content
|
113
|
+
end
|
112
114
|
end
|
113
115
|
|
114
116
|
protected
|
@@ -5,10 +5,10 @@ require 'active_support/core_ext/object/duplicable'
|
|
5
5
|
module ActionDispatch
|
6
6
|
module Http
|
7
7
|
# Allows you to specify sensitive parameters which will be replaced from
|
8
|
-
# the request log by looking in
|
9
|
-
# to filter. If a block is given, each key and
|
10
|
-
# hash and all subhashes is passed to it, the value
|
11
|
-
# using String#replace or similar method.
|
8
|
+
# the request log by looking in the query string of the request and all
|
9
|
+
# subhashes of the params hash to filter. If a block is given, each key and
|
10
|
+
# value of the params hash and all subhashes is passed to it, the value
|
11
|
+
# or key can be replaced using String#replace or similar method.
|
12
12
|
#
|
13
13
|
# Examples:
|
14
14
|
#
|
@@ -38,6 +38,11 @@ module ActionDispatch
|
|
38
38
|
@filtered_env ||= env_filter.filter(@env)
|
39
39
|
end
|
40
40
|
|
41
|
+
# Reconstructed a path with all sensitive GET parameters replaced.
|
42
|
+
def filtered_path
|
43
|
+
@filtered_path ||= query_string.empty? ? path : "#{path}?#{filtered_query_string}"
|
44
|
+
end
|
45
|
+
|
41
46
|
protected
|
42
47
|
|
43
48
|
def parameter_filter
|
@@ -52,6 +57,14 @@ module ActionDispatch
|
|
52
57
|
@@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
|
53
58
|
end
|
54
59
|
|
60
|
+
KV_RE = '[^&;=]+'
|
61
|
+
PAIR_RE = %r{(#{KV_RE})=(#{KV_RE})}
|
62
|
+
def filtered_query_string
|
63
|
+
query_string.gsub(PAIR_RE) do |_|
|
64
|
+
parameter_filter.filter([[$1, $2]]).first.join("=")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
55
68
|
end
|
56
69
|
end
|
57
70
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<h1>
|
2
2
|
<%=h @exception.class.to_s %>
|
3
3
|
<% if @request.parameters['controller'] %>
|
4
|
-
in <%=h @request.parameters['controller'].
|
4
|
+
in <%=h @request.parameters['controller'].classify.pluralize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %>
|
5
5
|
<% end %>
|
6
6
|
</h1>
|
7
7
|
<pre><%=h @exception.message %></pre>
|
@@ -295,6 +295,7 @@ module ActionDispatch
|
|
295
295
|
end
|
296
296
|
|
297
297
|
def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true)
|
298
|
+
raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i)
|
298
299
|
route = Route.new(self, app, conditions, requirements, defaults, name, anchor)
|
299
300
|
@set.add_route(*route)
|
300
301
|
named_routes[name] = route if name
|
@@ -396,7 +397,7 @@ module ActionDispatch
|
|
396
397
|
|
397
398
|
raise_routing_error unless path
|
398
399
|
|
399
|
-
params.reject! {|k,v| !v
|
400
|
+
params.reject! {|k,v| !v.to_param}
|
400
401
|
|
401
402
|
return [path, params.keys] if @extras
|
402
403
|
|
data/lib/action_pack/version.rb
CHANGED
@@ -864,7 +864,7 @@ module ActionView
|
|
864
864
|
def determine_source(source, collection)
|
865
865
|
case source
|
866
866
|
when Symbol
|
867
|
-
collection[source]
|
867
|
+
collection[source] || raise(ArgumentError, "No expansion found for #{source.inspect}")
|
868
868
|
else
|
869
869
|
source
|
870
870
|
end
|
@@ -472,7 +472,7 @@ module ActionView
|
|
472
472
|
end.keys.map{|e_name| DECIMAL_UNITS.invert[e_name] }.sort_by{|e| -e}
|
473
473
|
|
474
474
|
number_exponent = number != 0 ? Math.log10(number.abs).floor : 0
|
475
|
-
display_exponent = unit_exponents.find{|e| number_exponent >= e }
|
475
|
+
display_exponent = unit_exponents.find{ |e| number_exponent >= e } || 0
|
476
476
|
number /= 10 ** display_exponent
|
477
477
|
|
478
478
|
unit = case units
|
@@ -130,7 +130,6 @@ module ActionView
|
|
130
130
|
"new Ajax.Updater(#{update}, "
|
131
131
|
|
132
132
|
url_options = options[:url]
|
133
|
-
url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)
|
134
133
|
function << "'#{html_escape(escape_javascript(url_for(url_options)))}'"
|
135
134
|
function << ", #{javascript_options})"
|
136
135
|
|
@@ -1,13 +1,33 @@
|
|
1
1
|
require 'action_view/helpers/tag_helper'
|
2
|
+
require 'i18n/exceptions'
|
3
|
+
|
4
|
+
module I18n
|
5
|
+
class ExceptionHandler
|
6
|
+
include Module.new {
|
7
|
+
def call(exception, locale, key, options)
|
8
|
+
exception.is_a?(MissingTranslationData) ? super.html_safe : super
|
9
|
+
end
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
2
13
|
|
3
14
|
module ActionView
|
4
15
|
# = Action View Translation Helpers
|
5
16
|
module Helpers
|
6
17
|
module TranslationHelper
|
7
18
|
# Delegates to I18n#translate but also performs three additional functions.
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
19
|
+
#
|
20
|
+
# First, it'll pass the :rescue_format => :html option to I18n so that any caught
|
21
|
+
# MissingTranslationData exceptions will be turned into inline spans that
|
22
|
+
#
|
23
|
+
# * have a "translation-missing" class set,
|
24
|
+
# * contain the missing key as a title attribute and
|
25
|
+
# * a titleized version of the last key segment as a text.
|
26
|
+
#
|
27
|
+
# E.g. the value returned for a missing translation key :"blog.post.title" will be
|
28
|
+
# <span class="translation_missing" title="translation missing: blog.post.title">Title</span>.
|
29
|
+
# This way your views will display rather reasonableful strings but it will still
|
30
|
+
# be easy to spot missing translations.
|
11
31
|
#
|
12
32
|
# Second, it'll scope the key by the current partial if the key starts
|
13
33
|
# with a period. So if you call <tt>translate(".foo")</tt> from the
|
@@ -24,15 +44,13 @@ module ActionView
|
|
24
44
|
# naming convention helps to identify translations that include HTML tags so that
|
25
45
|
# you know what kind of output to expect when you call translate in a template.
|
26
46
|
def translate(key, options = {})
|
27
|
-
|
47
|
+
options.merge!(:rescue_format => :html) unless options.key?(:rescue_format)
|
48
|
+
translation = I18n.translate(scope_key_by_partial(key), options)
|
28
49
|
if html_safe_translation_key?(key) && translation.respond_to?(:html_safe)
|
29
50
|
translation.html_safe
|
30
51
|
else
|
31
52
|
translation
|
32
53
|
end
|
33
|
-
rescue I18n::MissingTranslationData => e
|
34
|
-
keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
|
35
|
-
content_tag('span', keys.join(', '), :class => 'translation_missing')
|
36
54
|
end
|
37
55
|
alias :t :translate
|
38
56
|
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424071
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- 6
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 3.0.6.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David Heinemeier Hansson
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-
|
20
|
+
date: 2011-03-29 00:00:00 -07:00
|
19
21
|
default_executable:
|
20
22
|
dependencies:
|
21
23
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +28,14 @@ dependencies:
|
|
26
28
|
requirements:
|
27
29
|
- - "="
|
28
30
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
31
|
+
hash: 15424071
|
30
32
|
segments:
|
31
33
|
- 3
|
32
34
|
- 0
|
33
|
-
-
|
34
|
-
|
35
|
+
- 6
|
36
|
+
- rc
|
37
|
+
- 1
|
38
|
+
version: 3.0.6.rc1
|
35
39
|
type: :runtime
|
36
40
|
version_requirements: *id001
|
37
41
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +46,14 @@ dependencies:
|
|
42
46
|
requirements:
|
43
47
|
- - "="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
49
|
+
hash: 15424071
|
46
50
|
segments:
|
47
51
|
- 3
|
48
52
|
- 0
|
49
|
-
-
|
50
|
-
|
53
|
+
- 6
|
54
|
+
- rc
|
55
|
+
- 1
|
56
|
+
version: 3.0.6.rc1
|
51
57
|
type: :runtime
|
52
58
|
version_requirements: *id002
|
53
59
|
- !ruby/object:Gem::Dependency
|
@@ -74,11 +80,12 @@ dependencies:
|
|
74
80
|
requirements:
|
75
81
|
- - ~>
|
76
82
|
- !ruby/object:Gem::Version
|
77
|
-
hash:
|
83
|
+
hash: 11
|
78
84
|
segments:
|
79
85
|
- 0
|
80
|
-
-
|
81
|
-
|
86
|
+
- 5
|
87
|
+
- 0
|
88
|
+
version: 0.5.0
|
82
89
|
type: :runtime
|
83
90
|
version_requirements: *id004
|
84
91
|
- !ruby/object:Gem::Dependency
|
@@ -121,12 +128,12 @@ dependencies:
|
|
121
128
|
requirements:
|
122
129
|
- - ~>
|
123
130
|
- !ruby/object:Gem::Version
|
124
|
-
hash:
|
131
|
+
hash: 27
|
125
132
|
segments:
|
126
133
|
- 0
|
127
134
|
- 6
|
128
|
-
-
|
129
|
-
version: 0.6.
|
135
|
+
- 14
|
136
|
+
version: 0.6.14
|
130
137
|
type: :runtime
|
131
138
|
version_requirements: *id007
|
132
139
|
- !ruby/object:Gem::Dependency
|
@@ -357,16 +364,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
357
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
358
365
|
none: false
|
359
366
|
requirements:
|
360
|
-
- - "
|
367
|
+
- - ">"
|
361
368
|
- !ruby/object:Gem::Version
|
362
|
-
hash:
|
369
|
+
hash: 25
|
363
370
|
segments:
|
364
|
-
-
|
365
|
-
|
371
|
+
- 1
|
372
|
+
- 3
|
373
|
+
- 1
|
374
|
+
version: 1.3.1
|
366
375
|
requirements:
|
367
376
|
- none
|
368
377
|
rubyforge_project: actionpack
|
369
|
-
rubygems_version: 1.
|
378
|
+
rubygems_version: 1.6.1
|
370
379
|
signing_key:
|
371
380
|
specification_version: 3
|
372
381
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|