2014/12/14分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Fix handling of positional url helper arguments when format is false
- allow URL helpers to work with optional scopes
Fix handling of positional url helper arguments when format is false https://github.com/rails/rails/commit/1a50be823186082e8b5a29d8e9ea3a289318d9c1
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
routingにformat: false
を指定した場合に、url helperが引数の扱いに誤りがあるバグがあったのを修正しています。
- if args.size < path_params.size - 1 # take format into account + # take format into account + if path_params.include?(:format) + path_params_size = path_params.size - 1 + else + path_params_size = path_params.size + end + + if args.size < path_params_size
"format"がある前提でpath_param.size -1
を行っているのですが、format: false
の場合"format"が無いので、判定がおかしくなってしまっていたようです。
ParameterFilter shouldn't try to dup symbol keys
actionpack/lib/action_dispatch/http/parameter_filter.rb
の修正です。
ParameterFilter
クラスでkeyの複製を行う際、duplicable?
チェックを行うよう修正しています。
{:controller=>"samples", :action=>"index"}
のように、keyがsymbolの場合にdup
出来なくてエラーになってしまうバグの対応です。
allow URL helpers to work with optional scopes
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
optional scopesを使用している際に、URL helpersが正しい値を返すよう修正しています。
draw do scope "(/:foo)" do resources :users end end url_helpers.user_path(1) # => '/users/1' url_helpers.user_path(1, foo: nil) # => '/users/1' url_helpers.user_path(1, foo: 'a') # => '/a/users/1'
Re-enable capture'ing non-String values
actionview/lib/action_view/helpers/capture_helper.rb
の修正です。
CaptureHelper#capture
メソッドがString以外の値もcaptureするよう修正しています。
# before ActionView::Base.new.capture { 1 } #=> nil # after ActionView::Base.new.capture { '1' } #=> nil
内部でcapture
メソッドを呼び出しているので、content_tag
メソッドも同じように挙動の変更があります。
# before content_tag(:p) { 1.0 } # => <p></p> # after content_tag(:p) { 1.0 } # => <p>1.0</p>
Merge pull request #18024 from carpodaster/fix/actionview/capture-non-strings