CHANGELOG.md 18.1 KB
Newer Older
1
## Rails 4.2.8 (February 21, 2017) ##
2 3 4 5

*   No changes.


6
## Rails 4.2.7 (July 12, 2016) ##
7 8 9 10

*   No changes.


11
## Rails 4.2.6 (March 07, 2016) ##
12 13 14 15

*   No changes.


16 17 18 19 20 21 22 23 24 25 26 27 28 29
## Rails 4.2.5.2 (February 26, 2016) ##

*   Do not allow render with unpermitted parameter.

    Fixes CVE-2016-2098.

    *Arthur Neves*


## Rails 4.2.5.1 (January 25, 2015) ##

*   No changes.


30
## Rails 4.2.5 (November 12, 2015) ##
R
Rafael Mendonça França 已提交
31

32 33 34 35 36
*   `ActionController::TestCase` can teardown gracefully if an error is raised
    early in the `setup` chain.

    *Yves Senn*

S
Sean Griffin 已提交
37 38 39 40
*   Parse RSS/ATOM responses as XML, not HTML.

    *Alexander Kaupanin*

41 42 43 44 45 46 47 48
*   Fix regression in mounted engine named routes generation for app deployed to
    a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
    "/subdir/subdir/engine_path" instead of "/subdir/engine_path")

    Fixes #20920. Fixes #21459.

    *Matthew Erhard*

49 50 51 52
*   `url_for` does not modify its arguments when generating polymorphic URLs.

    *Bernerd Schaefer*

Y
Yves Senn 已提交
53 54 55 56 57
*   Update `ActionController::TestSession#fetch` to behave more like
    `ActionDispatch::Request::Session#fetch` when using non-string keys.

    *Jeremy Friesen*

58

59
## Rails 4.2.4 (August 24, 2015) ##
60

61 62 63 64 65 66 67 68 69
*   ActionController::TestSession now accepts a default value as well as
    a block for generating a default value based off the key provided.

    This fixes calls to session#fetch in ApplicationController instances that
    take more two arguments or a block from raising `ArgumentError: wrong
    number of arguments (2 for 1)` when performing controller tests.

    *Matthew Gerrior*

70 71 72 73 74 75 76 77
*   Fix to keep original header instance in `ActionDispatch::SSL`

    `ActionDispatch::SSL` changes headers to `Hash`.
    So some headers will be broken if there are some middlewares
    on `ActionDispatch::SSL` and if it uses `Rack::Utils::HeaderHash`.

    *Fumiaki Matsushima*

78

79
## Rails 4.2.3 (June 25, 2015) ##
80

81 82 83 84 85 86 87
*   Fix rake routes not showing the right format when
    nesting multiple routes.

    See #18373.

    *Ravil Bayramgalin*

A
Arthur Neves 已提交
88 89 90 91 92 93 94
*   Fix regression where a gzip file response would have a Content-type,
    even when it was a 304 status code.

    See #19271.

    *Kohei Suzuki*

95 96 97 98 99 100 101 102
*   Fix handling of empty X_FORWARDED_HOST header in raw_host_with_port

    Previously, an empty X_FORWARDED_HOST header would cause
    Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
    Actiondispatch::Http:URL.host to raise a NoMethodError.

    *Adam Forsyth*

103 104 105 106 107 108 109 110 111 112
*   Fallback to `ENV['RAILS_RELATIVE_URL_ROOT']` in `url_for`.

    Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment variable is not
    prepended to the path when `url_for` is called. If `SCRIPT_NAME` (used by Rack)
    is set, it takes precedence.

    Fixes #5122.

    *Yasyf Mohamedali*

113 114 115 116 117 118 119
*   Fix regression in functional tests. Responses should have default headers
    assigned.

    See #18423.

    *Jeremy Kemper*, *Yves Senn*

120

121 122 123 124 125
## Rails 4.2.2 (June 16, 2015) ##

* No Changes *


126
## Rails 4.2.1 (March 19, 2015) ##
127

128 129 130 131 132
*   Non-string authenticity tokens do not raise NoMethodError when decoding
    the masked token.

    *Ville Lautanala*

133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
*   Explicitly ignored wildcard verbs when searching for HEAD routes before fallback

    Fixes an issue where a mounted rack app at root would intercept the HEAD
    request causing an incorrect behavior during the fall back to GET requests.

    Example:
    ```ruby
    draw do
        get '/home' => 'test#index'
        mount rack_app, at: '/'
    end
    head '/home'
    assert_response :success
    ```
    In this case, a HEAD request runs through the routes the first time and fails
    to match anything. Then, it runs through the list with the fallback and matches
    `get '/home'`. The original behavior would match the rack app in the first pass.

    *Terence Sun*

153 154 155 156 157 158 159 160 161 162
*   Preserve default format when generating URLs

    Fixes an issue that would cause the format set in default_url_options to be
    lost when generating URLs with fewer positional arguments than parameters in
    the route definition.

    Backport of #18627

    *Tekin Suleyman*, *Dominic Baggott*

163 164 165 166 167
*   Default headers, removed in controller actions, are no longer reapplied on
    the test response.

    *Jonas Baumann*

168 169 170 171 172 173 174 175 176 177 178
*   Ensure `append_info_to_payload` is called even if an exception is raised.

    Fixes an issue where when an exception is raised in the request the additonal
    payload data is not available.

    See:
    * #14903
    * https://github.com/roidrage/lograge/issues/37

    *Dieter Komendera*, *Margus Pärt*

179 180 181 182
*   Correctly rely on the response's status code to handle calls to `head`.

    *Robin Dupret*

183 184 185 186 187 188 189 190 191 192 193 194
*   Using `head` method returns empty response_body instead
    of returning a single space " ".

    The old behavior was added as a workaround for a bug in an early
    version of Safari, where the HTTP headers are not returned correctly
    if the response body has a 0-length. This is been fixed since and
    the workaround is no longer necessary.

    Fixes #18253.

    *Prathamesh Sonpatki*

195 196 197 198
*   Fix how polymorphic routes works with objects that implement `to_model`.

    *Travis Grathwell*

199 200 201 202 203 204
*   Fixed handling of positional url helper arguments when `format: false`.

    Fixes #17819.

    *Andrew White*, *Tatiana Soukiassian*

205 206 207 208
*   Fixed usage of optional scopes in URL helpers.

    *Alex Robbin*

209 210 211

## Rails 4.2.0 (December 20, 2014) ##

P
Prem Sichanugrist 已提交
212 213 214 215 216 217 218
*   Add `ActionController::Parameters#to_unsafe_h` to return an unfiltered
    `Hash` representation of Parameters object. This is now a preferred way to
    retrieve unfiltered parameters as we will stop inheriting `AC::Parameters`
    object in Rails 5.0.

    *Prem Sichanugrist*

219 220 221 222 223 224 225
*   Restore handling of a bare `Authorization` header, without `token=`
    prefix.

    Fixes #17108.

    *Guo Xiang Tan*

226 227
*   Deprecate use of string keys in URL helpers.

S
Sean Griffin 已提交
228 229
    Use symbols instead.
    Fixes #16958.
230

S
Sean Griffin 已提交
231
    *Byron Bischoff*, *Melanie Gilman*
232

233 234 235 236 237 238 239 240 241 242
*   Deprecate the `only_path` option on `*_path` helpers.

    In cases where this option is set to `true`, the option is redundant and can
    be safely removed; otherwise, the corresponding `*_url` helper should be
    used instead.

    Fixes #17294.

    *Dan Olson*, *Godfrey Chan*

Y
Yves Senn 已提交
243
*   Improve Journey compliance to RFC 3986.
244 245 246 247 248

    The scanner in Journey failed to recognize routes that use literals
    from the sub-delims section of RFC 3986. It's now able to parse those
    authorized delimiters and route as expected.

Y
Yves Senn 已提交
249
    Fixes #17212.
250 251 252

    *Nicolas Cavigneaux*

253 254 255 256 257 258 259 260 261 262 263 264 265
*   Deprecate implicit Array conversion for Response objects. It was added
    (using `#to_ary`) so we could conveniently use implicit splatting:

        status, headers, body = response

    But it also means `response + response` works and `[response].flatten`
    cascades down to the Rack body. Nonsense behavior. Instead, rely on
    explicit conversion and splatting with `#to_a`:

        status, header, body = *response

    *Jeremy Kemper*

266 267 268 269 270 271 272
*   Don't rescue `IPAddr::InvalidAddressError`.

    `IPAddr::InvalidAddressError` does not exist in Ruby 1.9.3
    and fails for JRuby in 1.9 mode.

    *Peter Suschlik*

273 274 275 276 277 278 279
*   Fix bug where the router would ignore any constraints added to redirect
    routes.

    Fixes #16605.

    *Agis Anastasopoulos*

S
Sam Aarons 已提交
280 281 282
*   Allow `config.action_dispatch.trusted_proxies` to accept an IPAddr object.

    Example:
Y
Yves Senn 已提交
283

S
Sam Aarons 已提交
284 285 286 287 288
        # config/environments/production.rb
        config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')

    *Sam Aarons*

289 290 291 292 293 294 295 296
*   Avoid duplicating routes for HEAD requests.

    Instead of duplicating the routes, we will first match the HEAD request to
    HEAD routes. If no match is found, we will then map the HEAD request to
    GET routes.

    *Guo Xiang Tan*, *Andrew White*

S
schneems 已提交
297 298 299 300 301 302
*   Requests that hit `ActionDispatch::Static` can now take advantage
    of gzipped assets on disk. By default a gzip asset will be served if
    the client supports gzip and a compressed file is on disk.

    *Richard Schneeman*

303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
*   `ActionController::Parameters` will stop inheriting from `Hash` and
    `HashWithIndifferentAccess` in the next major release. If you use any method
    that is not available on `ActionController::Parameters` you should consider
    calling `#to_h` to convert it to a `Hash` first before calling that method.

    *Prem Sichanugrist*

*   `ActionController::Parameters#to_h` now returns a `Hash` with unpermitted
    keys removed. This change is to reflect on a security concern where some
    method performed on an `ActionController::Parameters` may yield a `Hash`
    object which does not maintain `permitted?` status. If you would like to
    get a `Hash` with all the keys intact, duplicate and mark it as permitted
    before calling `#to_h`.

        params = ActionController::Parameters.new({
          name: 'Senjougahara Hitagi',
          oddity: 'Heavy stone crab'
        })
        params.to_h
        # => {}

        unsafe_params = params.dup.permit!
        unsafe_params.to_h
        # => {"name"=>"Senjougahara Hitagi", "oddity"=>"Heavy stone crab"}

        safe_params = params.permit(:name)
        safe_params.to_h
        # => {"name"=>"Senjougahara Hitagi"}

    This change is consider a stopgap as we cannot change the code to stop
    `ActionController::Parameters` to inherit from `HashWithIndifferentAccess`
    in the next minor release.

    *Prem Sichanugrist*

Y
Yves Senn 已提交
338
*   Deprecated `TagAssertions`.
339

340 341
    *Kasper Timm Hansen*

342 343 344 345 346 347 348 349
*   Use the Active Support JSON encoder for cookie jars using the `:json` or
    `:hybrid` serializer. This allows you to serialize custom Ruby objects into
    cookies by defining the `#as_json` hook on such objects.

    Fixes #16520.

    *Godfrey Chan*

350 351 352 353 354
*   Add `config.action_dispatch.cookies_digest` option for setting custom
    digest. The default remains the same - 'SHA1'.

    *Łukasz Strzałkowski*

355 356 357 358 359
*   Move `respond_with` (and the class-level `respond_to`) to
    the `responders` gem.

    *José Valim*

360 361 362 363 364 365 366 367 368 369
*   When your templates change, browser caches bust automatically.

    New default: the template digest is automatically included in your ETags.
    When you call `fresh_when @post`, the digest for `posts/show.html.erb`
    is mixed in so future changes to the HTML will blow HTTP caches for you.
    This makes it easy to HTTP-cache many more of your actions.

    If you render a different template, you can now pass the `:template`
    option to include its digest instead:

Y
Yves Senn 已提交
370
        fresh_when @post, template: 'widgets/show'
371 372 373

    Pass `template: false` to skip the lookup. To turn this off entirely, set:

Y
Yves Senn 已提交
374
        config.action_controller.etag_with_template_digest = false
375 376 377

    *Jeremy Kemper*

378 379 380 381 382
*   Remove deprecated `AbstractController::Helpers::ClassMethods::MissingHelperError`
    in favor of `AbstractController::Helpers::MissingHelperError`.

    *Yves Senn*

G
Guo Xiang Tan 已提交
383 384 385 386
*   Fix `assert_template` not being able to assert that no files were rendered.

    *Guo Xiang Tan*

R
Ryan Dao 已提交
387 388 389 390 391
*   Extract source code for the entire exception stack trace for
    better debugging and diagnosis.

    *Ryan Dao*

A
Arthur Neves 已提交
392 393 394 395 396
*   Allows ActionDispatch::Request::LOCALHOST to match any IPv4 127.0.0.0/8
    loopback address.

    *Earl St Sauver*, *Sven Riedel*

397 398 399 400 401 402 403 404 405 406 407
*   Preserve original path in `ShowExceptions` middleware by stashing it as
    `env["action_dispatch.original_path"]`

    `ActionDispatch::ShowExceptions` overwrites `PATH_INFO` with the status code
    for the exception defined in `ExceptionWrapper`, so the path
    the user was visiting when an exception occurred was not previously
    available to any custom exceptions_app. The original `PATH_INFO` is now
    stashed in `env["action_dispatch.original_path"]`.

    *Grey Baker*

408 409 410 411
*   Use `String#bytesize` instead of `String#size` when checking for cookie
    overflow.

    *Agis Anastasopoulos*
412

413 414 415 416 417 418 419 420 421 422 423 424 425 426
*   `render nothing: true` or rendering a `nil` body no longer add a single
    space to the response body.

    The old behavior was added as a workaround for a bug in an early version of
    Safari, where the HTTP headers are not returned correctly if the response
    body has a 0-length. This is been fixed since and the workaround is no
    longer necessary.

    Use `render body: ' '` if the old behavior is desired.

    See #14883 for details.

    *Godfrey Chan*

427
*   Prepend a JS comment to JSONP callbacks. Addresses CVE-2014-4671
Y
Yves Senn 已提交
428
    ("Rosetta Flash").
429 430 431

    *Greg Campbell*

432 433 434 435 436 437 438 439 440
*   Because URI paths may contain non US-ASCII characters we need to force
    the encoding of any unescaped URIs to UTF-8 if they are US-ASCII.
    This essentially replicates the functionality of the monkey patch to
    URI.parser.unescape in active_support/core_ext/uri.rb.

    Fixes #16104.

    *Karl Entwistle*

441 442 443 444 445 446
*   Generate shallow paths for all children of shallow resources.

    Fixes #15783.

    *Seb Jacobs*

447 448 449 450 451 452 453
*   JSONP responses are now rendered with the `text/javascript` content type
    when rendering through a `respond_to` block.

    Fixes #15081.

    *Lucas Mazza*

454 455 456
*   Add `config.action_controller.always_permitted_parameters` to configure which
    parameters are permitted globally. The default value of this configuration is
    `['controller', 'action']`.
457

458
    *Gary S. Weaver*, *Rafael Chacon*
459

460 461 462 463 464 465
*   Fix env['PATH_INFO'] missing leading slash when a rack app mounted at '/'.

    Fixes #15511.

    *Larry Lv*

466
*   ActionController::Parameters#require now accepts `false` values.
467 468 469 470 471

    Fixes #15685.

    *Sergio Romano*

472 473 474 475 476 477 478
*   With authorization header `Authorization: Token token=`, `authenticate` now
    recognize token as nil, instead of "token".

    Fixes #14846.

    *Larry Lv*

479 480 481 482 483
*   Ensure the controller is always notified as soon as the client disconnects
    during live streaming, even when the controller is blocked on a write.

    *Nicholas Jakobsen*, *Matthew Draper*

484 485 486 487
*   Routes specifying 'to:' must be a string that contains a "#" or a rack
    application.  Use of a symbol should be replaced with `action: symbol`.
    Use of a string without a "#" should be replaced with `controller: string`.

488 489
    *Aaron Patterson*

490 491 492 493 494
*   Fix URL generation with `:trailing_slash` such that it does not add
    a trailing slash after `.:format`

    *Dan Langevin*

495
*   Build full URI as string when processing path in integration tests for
496 497 498 499
    performance reasons. One consequence of this is that the leading slash
    is now required in integration test `process` helpers, whereas previously
    it could be omitted. The fact that this worked was a unintended consequence
    of the implementation and was never an intentional feature.
500 501 502

    *Guo Xiang Tan*

Z
Zachary Scott 已提交
503
*   Fix `'Stack level too deep'` when rendering `head :ok` in an action method
504 505 506 507 508 509
    called 'status' in a controller.

    Fixes #13905.

    *Christiaan Van den Poel*

510 511 512 513
*   Add MKCALENDAR HTTP method (RFC 4791).

    *Sergey Karpesh*

514 515 516 517 518 519 520 521
*   Instrument fragment cache metrics.

    Adds `:controller`: and `:action` keys to the instrumentation payload
    for the `*_fragment.action_controller` notifications. This allows tracking
    e.g. the fragment cache hit rates for each controller action.

    *Daniel Schierbeck*

522 523 524 525 526 527
*   Always use the provided port if the protocol is relative.

    Fixes #15043.

    *Guilherme Cavalcanti*, *Andrew White*

528 529 530 531 532 533 534
*   Moved `params[request_forgery_protection_token]` into its own method
    and improved tests.

    Fixes #11316.

    *Tom Kadwill*

535
*   Added verification of route constraints given as a Proc or an object responding
536 537
    to `:matches?`. Previously, when given an non-complying object, it would just
    silently fail to enforce the constraint. It will now raise an `ArgumentError`
538 539 540 541
    when setting up the routes.

    *Xavier Defrang*

542 543 544 545 546 547 548 549
*   Properly treat the entire IPv6 User Local Address space as private for
    purposes of remote IP detection. Also handle uppercase private IPv6
    addresses.

    Fixes #12638.

    *Caleb Spare*

550 551 552 553 554 555 556 557 558 559 560 561 562
*   Fixed an issue with migrating legacy json cookies.

    Previously, the `VerifyAndUpgradeLegacySignedMessage` assumes all incoming
    cookies are marshal-encoded. This is not the case when `secret_token` is
    used in conjunction with the `:json` or `:hybrid` serializer.

    In those case, when upgrading to use `secret_key_base`, this would cause a
    `TypeError: incompatible marshal file format` and a 500 error for the user.

    Fixes #14774.

    *Godfrey Chan*

A
Andrew White 已提交
563 564 565 566 567 568 569 570
*   Make URL escaping more consistent:

    1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers
    2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters
    3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation
    4. Use `escape_segment` rather than `escape_path` in URL generation

    For point 4 there are two exceptions. Firstly, when a route uses wildcard segments
Z
Zachary Scott 已提交
571
    (e.g. `*foo`) then we use `escape_path` as the value may contain '/' characters. This
A
Andrew White 已提交
572 573 574 575 576 577 578
    means that wildcard routes can't be optimized. Secondly, if a `:controller` segment
    is used in the path then this uses `escape_path` as the controller may be namespaced.

    Fixes #14629, #14636 and #14070.

    *Andrew White*, *Edho Arief*

579 580 581 582 583
*   Add alias `ActionDispatch::Http::UploadedFile#to_io` to
    `ActionDispatch::Http::UploadedFile#tempfile`.

    *Tim Linquist*

584 585 586 587 588 589 590
*   Returns null type format when format is not know and controller is using `any`
    format block.

    Fixes #14462.

    *Rafael Mendonça França*

591 592 593 594
*   Improve routing error page with fuzzy matching search.

    *Winston*

595 596 597 598 599 600
*   Only make deeply nested routes shallow when parent is shallow.

    Fixes #14684.

    *Andrew White*, *James Coglan*

Z
Zachary Scott 已提交
601
*   Append link to bad code to backtrace when exception is `SyntaxError`.
602 603

    *Boris Kuznetsov*
604

605
*   Swapped the parameters of assert_equal in `assert_select` so that the
606
    proper values were printed correctly.
607 608 609 610 611

    Fixes #14422.

    *Vishal Lal*

612 613 614 615 616 617 618 619
*   The method `shallow?` returns false if the parent resource is a singleton so
    we need to check if we're not inside a nested scope before copying the :path
    and :as options to their shallow equivalents.

    Fixes #14388.

    *Andrew White*

620 621
*   Make logging of CSRF failures optional (but on by default) with the
    `log_warning_on_csrf_failure` configuration setting in
622
    `ActionController::RequestForgeryProtection`.
623 624

    *John Barton*
625

626 627 628 629 630
*   Fix URL generation in controller tests with request-dependent
    `default_url_options` methods.

    *Tony Wooster*

631
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionpack/CHANGELOG.md) for previous changes.