CHANGELOG.md 29.8 KB
Newer Older
1
## Rails 4.0.0 (unreleased) ##
2

3 4 5 6 7 8 9 10
*   Return the last valid, non-private IP address from the X-Forwarded-For,
    Client-IP and Remote-Addr headers, in that order. Document the rationale
    for that decision, and describe the options that can be passed to the
    RemoteIp middleware to change it.
    Fix #7979

    *André Arko*, *Steve Klabnik*, *Alexey Gaziev*

11
*   Do not append second slash to `root_url` when using `trailing_slash: true`
12 13 14 15 16 17 18 19 20 21 22
    Fix #8700

    Example:
        # before
        root_url # => http://test.host//

        # after
        root_url # => http://test.host/

    *Yves Senn*

23 24 25 26
*   Allow to toggle dumps on error pages.

    *Gosha Arinich*

27
*   Fix a bug in `content_tag_for` that prevents it from working without a block.
28 29 30

    *Jasl*

31 32 33 34 35 36
*   Change the stylesheet of exception pages for development mode.
    Additionally display also the line of code and fragment that raised
    the exception in all exceptions pages.

    *Guillermo Iguaran + Jorge Cuadrado*

37 38 39 40 41 42
*   Do not append `charset=` parameter when `head` is called with a
    `:content_type` option.
    Fix #8661.

    *Yves Senn*

43 44
*   Added `Mime::NullType` class. This  allows to use html?, xml?, json?..etc when
    the `format` of `request` is unknown, without raise an exception.
45

46 47
    *Angelo Capilleri*

48 49 50 51 52
*   Integrate the Journey gem into Action Dispatch so that the global namespace
    is not polluted with names that may be used as models.

    *Andrew White*

53 54 55 56 57
*   Extract support for email address obfuscation via `:encode`, `:replace_at`, and `replace_dot`
    options from the `mail_to` helper into the `actionview-encoded_mail_to` gem.

    *Nick Reed + DHH*

58 59 60 61
*   Handle `:protocol` option in `stylesheet_link_tag` and `javascript_include_tag`

    *Vasiliy Ermolovich*

62 63
*   Clear url helper methods when routes are reloaded. *Andrew White*

64
*   Fix a bug in `ActionDispatch::Request#raw_post` that caused `env['rack.input']`
65 66 67 68
    to be read but not rewound.

    *Matt Venables*

69 70
*   Prevent raising EOFError on multipart GET request (IE issue). *Adam Stankiewicz*

71 72 73
*   Rename all action callbacks from *_filter to *_action to avoid the misconception that these
    callbacks are only suited for transforming or halting the response. With the new style,
    it's more inviting to use them as they were intended, like setting shared ivars for views.
74

75
    Example:
76

77
        class PeopleController < ActionController::Base
78 79
          before_action :set_person,      except: [:index, :new, :create]
          before_action :ensure_permission, only: [:edit, :update]
80

81
          ...
82

83 84 85 86
          private
            def set_person
              @person = current_account.people.find(params[:id])
            end
87

88
            def ensure_permission
D
David Heinemeier Hansson 已提交
89
              current_person.can_change?(@person)
90 91
            end
        end
92

93
    The old *_filter methods still work with no deprecation notice.
94

95 96
    *DHH*

97
*   Add `cache_if` and `cache_unless` for conditional fragment caching:
98

99 100 101 102 103 104 105
    Example:

        <%= cache_if condition, project do %>
          <b>All the topics on this project</b>
          <%= render project.topics %>
        <% end %>

106
        # and
107

108 109 110 111
        <%= cache_unless condition, project do %>
          <b>All the topics on this project</b>
          <%= render project.topics %>
        <% end %>
112

113
    *Stephen Ausman + Fabrizio Regini + Angelo Capilleri*
114

115 116 117 118 119 120
*   Add filter capability to ActionController logs for redirect locations:

        config.filter_redirect << 'http://please.hide.it/'

    *Fabrizio Regini*

121 122 123 124
*   Fixed a bug that ignores constraints on a glob route. This was caused because the constraint
    regular expression is overwritten when the `routes.rb` file is processed. Fixes #7924

    *Maura Fitzgerald*
J
José Valim 已提交
125

126 127 128 129
*   More descriptive error messages when calling `render :partial` with
    an invalid `:layout` argument.
    #8376

130
        render partial: 'partial', layout: true
131 132 133 134 135

        # results in ActionView::MissingTemplate: Missing partial /true

    *Yves Senn*

136 137 138 139
*   Sweepers was extracted from Action Controller as `rails-observers` gem.

    *Rafael Mendonça França*

140 141 142 143 144 145 146 147
*   Add option flag to `CacheHelper#cache` to manually bypass automatic template digests:

        <% cache project, skip_digest: true do %>
          ...
        <% end %>

    *Drew Ulmer*

148
*   No sort Hash options in `grouped_options_for_select`. *Sergey Kojin*
149

150
*   Accept symbols as `send_data :disposition` value *Elia Schito*
151

152
*   Add i18n scope to `distance_of_time_in_words`. *Steve Klabnik*
S
Steve Klabnik 已提交
153

154 155 156
*   `assert_template`:
    - is no more passing with empty string.
    - is now validating option keys. It accepts: `:layout`, `:partial`, `:locals` and `:count`.
157 158 159

    *Roberto Soares*

160 161
*   Allow setting a symbol as path in scope on routes. This is now allowed:

162 163 164
        scope :api do
          resources :users
        end
165

166
    It is also possible to pass multiple symbols to scope to shorten multiple nested scopes:
167

168 169 170 171
        scope :api do
          scope :v1 do
            resources :users
          end
172 173 174 175
        end

    can be rewritten as:

176 177 178
        scope :api, :v1 do
          resources :users
        end
179

180
    *Guillermo Iguaran + Amparo Luna*
181

182 183 184 185 186 187 188 189 190 191 192 193
*   Fix error when using a non-hash query argument named "params" in `url_for`.

    Before:

        url_for(params: "") # => undefined method `reject!' for "":String

    After:

        url_for(params: "") # => http://www.example.com?params=

    *tumayun + Carlos Antonio da Silva*

194 195 196 197 198 199
*   Render every partial with a new `ActionView::PartialRenderer`. This resolves
    issues when rendering nested partials.
    Fix #8197

    *Yves Senn*

200 201 202 203 204 205 206
*   Introduce `ActionView::Template::Handlers::ERB.escape_whitelist`. This is a list
    of mime types where template text is not html escaped by default. It prevents `Jack & Joe`
    from rendering as `Jack &amp; Joe` for the whitelisted mime types. The default whitelist
    contains text/plain. Fix #7976

    *Joost Baaij*

207
*   Fix input name when `multiple: true` and `:index` are set.
208 209 210

    Before:

211
        check_box("post", "comment_ids", { multiple: true, index: "foo" }, 1)
212 213 214 215
        #=> <input name=\"post[foo][comment_ids]\" type=\"hidden\" value=\"0\" /><input id=\"post_foo_comment_ids_1\" name=\"post[foo][comment_ids]\" type=\"checkbox\" value=\"1\" />

    After:

216
        check_box("post", "comment_ids", { multiple: true, index: "foo" }, 1)
217 218 219 220 221 222
        #=> <input name=\"post[foo][comment_ids][]\" type=\"hidden\" value=\"0\" /><input id=\"post_foo_comment_ids_1\" name=\"post[foo][comment_ids][]\" type=\"checkbox\" value=\"1\" />

    Fix #8108

    *Daniel Fox, Grant Hutchins & Trace Wax*

223 224 225 226 227
*   `BestStandardsSupport` middleware now appends it's `X-UA-Compatible` value to app's
    returned value if any. Fix #8086

    *Nikita Afanasenko*

228 229 230 231 232
*   `date_select` helper accepts `with_css_classes: true` to add css classes similar with type
    of generated select tags.

    *Pavel Nikitin*

233 234 235 236
*   Only non-js/css under app/assets path will be included in default config.assets.precompile.

    *Josh Peek*

237 238 239 240 241
*   Remove support for the RAILS_ASSET_ID environment configuration
    (no longer needed now that we have the asset pipeline).

    *Josh Peek*

242 243 244 245
*   Remove old asset_path configuration (no longer needed now that we have the asset pipeline).

    *Josh Peek*

246 247 248 249 250
*   `assert_template` can be used to assert on the same template with different locals
    Fix #3675

    *Yves Senn*

251 252 253
*   Remove old asset tag concatenation (no longer needed now that we have the asset pipeline).

    *Josh Peek*
254

255 256
*   Accept :remote as symbolic option for `link_to` helper. *Riley Lynch*

257 258 259 260 261 262
*   Warn when the `:locals` option is passed to `assert_template` outside of a view test case
    Fix #3415

    *Yves Senn*

*   The `Rack::Cache` middleware is now disabled by default. To enable it,
263 264 265 266
    set `config.action_dispatch.rack_cache = true` and add `gem rack-cache` to your Gemfile.

    *Guillermo Iguaran*

267 268 269 270 271 272 273 274 275 276 277
*   `ActionController::Base.page_cache_extension` option is deprecated
    in favour of `ActionController::Base.default_static_extension`.

    *Francesco Rodriguez*

*   Action and Page caching has been extracted from Action Dispatch
    as `actionpack-action_caching` and `actionpack-page_caching` gems.
    Please read the `README.md` file on both gems for the usage.

    *Francesco Rodriguez*

278 279
*   Failsafe exception returns text/plain. *Steve Klabnik*

280
*   Remove `rack-cache` dependency from Action Pack and declare it on Gemfile
281

282
    *Guillermo Iguaran*
283

284 285 286 287 288 289
*   Rename internal variables on ActionController::TemplateAssertions to prevent
    naming collisions. @partials, @templates and @layouts are now prefixed with an underscore.
    Fix #7459

    *Yves Senn*

290 291 292 293 294
*   `resource` and `resources` don't modify the passed options hash
    Fix #7777

    *Yves Senn*

295 296 297 298 299 300 301 302 303 304 305 306 307 308
*   Precompiled assets include aliases from foo.js to foo/index.js and vice versa.

        # Precompiles phone-<digest>.css and aliases phone/index.css to phone.css.
        config.assets.precompile = [ 'phone.css' ]

        # Precompiles phone/index-<digest>.css and aliases phone.css to phone/index.css.
        config.assets.precompile = [ 'phone/index.css' ]

        # Both of these work with either precompile thanks to their aliases.
        <%= stylesheet_link_tag 'phone', media: 'all' %>
        <%= stylesheet_link_tag 'phone/index', media: 'all' %>

    *Jeremy Kemper*

309 310
*   `assert_template` is no more passing with what ever string that matches
    with the template name.
311

312 313 314
    Before when we have a template `/layout/hello.html.erb`, `assert_template`
    was passing with any string that matches. This behavior allowed false
    positive like:
315

316 317
        assert_template "layout"
        assert_template "out/hello"
318

319
    Now it only passes with:
320

321 322 323 324
        assert_template "layout/hello"
        assert_template "hello"

    Fixes #3849.
325

326
    *Hugolnx*
327

328 329 330 331 332
*   `image_tag` will set the same width and height for image if numerical value
    passed to `size` option.

    *Nihad Abbasov*

333 334 335 336 337
*   Deprecate Mime::Type#verify_request? and Mime::Type.browser_generated_types,
    since they are no longer used inside of Rails, they will be removed in Rails 4.1

    *Michael Grosser*

338 339
*   `ActionDispatch::Http::UploadedFile` now delegates `close` to its tempfile. *Sergio Gil*

340
*   Add `ActionController::StrongParameters`, this module converts `params` hash into
341
    an instance of ActionController::Parameters that allows whitelisting of permitted
342
    parameters. Non-permitted parameters are forbidden to be used in Active Model by default
343
    For more details check the documentation of the module or the
344 345 346 347 348
    [strong_parameters gem](https://github.com/rails/strong_parameters)

    *DHH + Guillermo Iguaran*

*   Remove Integration between `attr_accessible`/`attr_protected` and
349
    `ActionController::ParamsWrapper`. ParamWrapper now wraps all the parameters returned
350 351 352 353
    by the class method attribute_names

    *Guillermo Iguaran*

354 355 356 357
*   Fix #7646, the log now displays the correct status code when an exception is raised.

    *Yves Senn*

358 359 360
*   Allow pass couple extensions to `ActionView::Template.register_template_handler` call.

    *Tima Maslyuchenko*
361

362 363
*   Sprockets integration has been extracted from Action Pack to the `sprockets-rails`
    gem. `rails` gem is depending on `sprockets-rails` by default.
364 365 366

    *Guillermo Iguaran*

367 368 369 370
*   `ActionDispatch::Session::MemCacheStore` now uses `dalli` instead of the deprecated
    `memcache-client` gem. As side effect the autoloading of unloaded classes objects
    saved as values in session isn't supported anymore when mem_cache session store is
    used, this can have an impact in apps only when config.cache_classes is false.
371 372 373

    *Arun Agrawal + Guillermo Iguaran*

374 375
*   Support multiple etags in If-None-Match header. *Travis Warlick*

S
Sergey Nartimov 已提交
376 377 378 379 380 381 382 383 384 385 386 387
*   Allow to configure how unverified request will be handled using `:with`
    option in `protect_from_forgery` method.

    Valid unverified request handling methods are:

    - `:exception` - Raises ActionController::InvalidAuthenticityToken exception.
    - `:reset_session` - Resets the session.
    - `:null_session` - Provides an empty session during request but doesn't
      reset it completely. Used as default if `:with` option is not specified.

    New applications are generated with:

388
        protect_from_forgery with: :exception
S
Sergey Nartimov 已提交
389 390 391

    *Sergey Nartimov*

392
*   Add .ruby template handler, this handler simply allows arbitrary Ruby code as a template. *Guillermo Iguaran*
G
Guillermo Iguaran 已提交
393

394 395
*   Add `separator` option for `ActionView::Helpers::TextHelper#excerpt`:

396
        excerpt('This is a very beautiful morning', 'very', separator: ' ', radius: 1)
397 398 399
        # => ...a very beautiful...

    *Guirec Corbel*
400

401 402
*   Added controller-level etag additions that will be part of the action etag computation *Jeremy Kemper/DHH*

403 404 405 406 407 408 409 410
        class InvoicesController < ApplicationController
          etag { current_user.try :id }

          def show
            # Etag will differ even for the same invoice when it's viewed by a different current_user
            @invoice = Invoice.find(params[:id])
            fresh_when(@invoice)
          end
411 412
        end

413
*   Add automatic template digests to all `CacheHelper#cache` calls (originally spiked in the cache_digests plugin) *DHH*
414

415 416 417 418 419
*   When building a URL fails, add missing keys provided by Journey. Failed URL
    generation now returns a 500 status instead of a 404.

    *Richard Schneeman*

420
*   Deprecate availbility of `ActionView::RecordIdentifier` in controllers by default.
421
    It's view specific and can be easily included in controller manually if someone
422 423
    really needs it. RecordIdentifier will be removed from `ActionController::Base`
    in Rails 4.1. *Piotr Sarnacki*
424

425
*   Fix `ActionView::RecordIdentifier` to work as a singleton. *Piotr Sarnacki*
426

427
*   Deprecate `Template#mime_type`, it will be removed in Rails 4.1 in favor of `#type`.
428 429
    *Piotr Sarnacki*

430
*   Move vendored html-scanner from `action_controller` to `action_view` directory. If you
431
    require it directly, please use 'action_view/vendor/html-scanner', reference to
432
    'action_controller/vendor/html-scanner' will be removed in Rails 4.1. *Piot Sarnacki*
433

434 435 436 437 438
*   Fix handling of date selects when using both disabled and discard options.
    Fixes #7431.

    *Vasiliy Ermolovich*

439 440 441 442
*   `ActiveRecord::SessionStore` is extracted out of Rails into a gem `activerecord-session_store`.
    Setting `config.session_store` to `:active_record_store` will no longer work and will break
    if the `activerecord-session_store` gem isn't available. *Prem Sichanugrist*

443
*   Fix `select_tag` when `option_tags` is nil.
444 445 446 447
    Fixes #7404.

    *Sandeep Ravichandran*

448
*   Add `Request#formats=(extensions)` that lets you set multiple formats directly in a prioritized order.
449 450 451

    Example of using this for custom iphone views with an HTML fallback:

452 453 454 455 456 457 458 459
        class ApplicationController < ActionController::Base
          before_filter :adjust_format_for_iphone_with_html_fallback

          private
            def adjust_format_for_iphone_with_html_fallback
              request.formats = [ :iphone, :html ] if request.env["HTTP_USER_AGENT"][/iPhone/]
            end
        end
460

461
    *DHH*
462

463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
*   Add Routing Concerns to declare common routes that can be reused inside
    others resources and routes.

    Code before:

        resources :messages do
          resources :comments
        end

        resources :posts do
          resources :comments
          resources :images, only: :index
        end

    Code after:

        concern :commentable do
          resources :comments
        end

        concern :image_attachable do
          resources :images, only: :index
        end

        resources :messages, concerns: :commentable

        resources :posts, concerns: [:commentable, :image_attachable]

491
    *DHH + Rafael Mendonça França*
492

493
*   Add `start_hour` and `end_hour` options to the `select_hour` helper. *Evan Tann*
494

495
*   Raises an `ArgumentError` when the first argument in `form_for` contain `nil`
496 497 498 499
    or is empty.

    *Richard Schneeman*

500 501 502
*   Add 'X-Frame-Options' => 'SAMEORIGIN'
    'X-XSS-Protection' => '1; mode=block' and
    'X-Content-Type-Options' => 'nosniff'
503 504 505 506
    as default headers.

    *Egor Homakov*

507 508
*   Allow data attributes to be set as a first-level option for form_for, so you can write `form_for @record, data: { behavior: 'autosave' }` instead of `form_for @record, html: { data: { behavior: 'autosave' } }` *DHH*

509 510 511 512
*   Deprecate `button_to_function` and `link_to_function` helpers.

    We recommend the use of Unobtrusive JavaScript instead. For example:

513
        link_to "Greeting", "#", class: "nav_link"
514

515 516 517
        $(function() {
          $('.nav_link').click(function() {
            // Some complex code
518

519 520
            return false;
          });
521 522 523 524
        });

    or

525
        link_to "Greeting", '#', onclick: "alert('Hello world!'); return false", class: "nav_link"
526 527 528 529 530

    for simple cases.

    *Rafael Mendonça França*

531 532
*   `javascript_include_tag :all` will now not include `application.js` if the file does not exists. *Prem Sichanugrist*

533 534 535 536
*   Send an empty response body when call `head` with status between 100 and 199, 204, 205 or 304.

    *Armand du Plessis*

537
*   Fixed issue with where digest authentication would not work behind a proxy. *Arthur Smith*
538

539
*   Added `ActionController::Live`.  Mix it in to your controller and you can
A
Aaron Patterson 已提交
540 541
    stream data to the client live.  For example:

542 543
        class FooController < ActionController::Base
          include ActionController::Live
A
Aaron Patterson 已提交
544

545 546 547 548 549 550 551 552
          def index
            100.times {
              # Client will see this as it's written
              response.stream.write "hello world\n"
              sleep 1
            }
            response.stream.close
          end
A
Aaron Patterson 已提交
553 554
        end

555 556 557
    *Aaron Patterson*

*   Remove `ActionDispatch::Head` middleware in favor of `Rack::Head`. *Santiago Pastorino*
S
Santiago Pastorino 已提交
558

559
*   Deprecate `:confirm` in favor of `data: { confirm: "Text" }` option for `button_to`, `button_tag`, `image_submit_tag`, `link_to` and `submit_tag` helpers.
560

561
    *Carlos Galdino + Rafael Mendonça França*
562

563
*   Show routes in exception page while debugging a `RoutingError` in development. *Richard Schneeman and Mattt Thompson*
564

K
kennyj 已提交
565 566 567 568 569 570
*   Add `ActionController::Flash.add_flash_types` method to allow people to register their own flash types. e.g.:

        class ApplicationController
          add_flash_types :error, :warning
        end

571
    If you add the above code, you can use `<%= error %>` in an erb, and `redirect_to /foo, error: 'message'` in a controller.
K
kennyj 已提交
572 573 574

    *kennyj*

575 576
*   Remove Active Model dependency from Action Pack. *Guillermo Iguaran*

577 578 579 580 581 582 583 584 585 586
*   Support unicode characters in routes. Route will be automatically escaped, so instead of manually escaping:

        get Rack::Utils.escape('こんにちは') => 'home#index'

    You just have to write the unicode route:

        get 'こんにちは' => 'home#index'

    *kennyj*

587 588
*   Return proper format on exceptions. *Santiago Pastorino*

589
*   Allow to use `mounted_helpers` (helpers for accessing mounted engines) in `ActionView::TestCase`. *Piotr Sarnacki*
590

591
*   Include `mounted_helpers` (helpers for accessing mounted engines) in `ActionDispatch::IntegrationTest` by default. *Piotr Sarnacki*
592

593 594 595 596
*   Extracted redirect logic from `ActionController::ForceSSL::ClassMethods.force_ssl`  into `ActionController::ForceSSL#force_ssl_redirect`

    *Jeremy Friesen*

597
*   Make possible to use a block in `button_to` if the button text is hard
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
    to fit into the name parameter, e.g.:

        <%= button_to [:make_happy, @user] do %>
          Make happy <strong><%= @user.name %></strong>
        <% end %>
        # => "<form method="post" action="/users/1/make_happy" class="button_to">
        #      <div>
        #        <button type="submit">
        #          Make happy <strong>Name</strong>
        #        </button>
        #      </div>
        #    </form>"

    *Sergey Nartimov*

613 614 615 616 617 618 619 620 621 622 623
*   change a way of ordering helpers from several directories. Previously,
    when loading helpers from multiple paths, all of the helpers files were
    gathered into one array an then they were sorted. Helpers from different
    directories should not be mixed before loading them to make loading more
    predictable. The most common use case for such behavior is loading helpers
    from engines. When you load helpers from application and engine Foo, in
    that order, first rails will load all of the helpers from application,
    sorted alphabetically and then it will do the same for Foo engine.

    *Piotr Sarnacki*

624
*   `truncate` now always returns an escaped HTML-safe string. The option `:escape` can be used as
625 626 627 628
    false to not escape the result.

    *Li Ellis Gallardo + Rafael Mendonça França*

629 630
*   `truncate` now accepts a block to show extra content when the text is truncated. *Li Ellis Gallardo*

C
Carlos Galdino 已提交
631 632 633
*   Add `week_field`, `week_field_tag`, `month_field`, `month_field_tag`, `datetime_local_field`,
    `datetime_local_field_tag`, `datetime_field` and `datetime_field_tag` helpers. *Carlos Galdino*

634 635
*   Add `color_field` and `color_field_tag` helpers. *Carlos Galdino*

636 637 638
*   `assert_generates`, `assert_recognizes`, and `assert_routing` all raise
    `Assertion` instead of `RoutingError` *David Chelimsky*

639 640
*   URL path parameters with invalid encoding now raise ActionController::BadRequest. *Andrew White*

641 642
*   Malformed query and request parameter hashes now raise ActionController::BadRequest. *Andrew White*

643 644 645 646
*   Add `divider` option to `grouped_options_for_select` to generate a separator
    `optgroup` automatically, and deprecate `prompt` as third argument, in favor
    of using an options hash. *Nicholas Greenfield*

647 648
*   Add `time_field` and `time_field_tag` helpers which render an `input[type="time"]` tag. *Alex Soulim*

649 650
*   Removed old text_helper apis for highlight, excerpt and word_wrap *Jeremy Walker*

J
José Valim 已提交
651 652 653
*   Templates without a handler extension now raises a deprecation warning but still
    defaults to ERb. In future releases, it will simply return the template contents. *Steve Klabnik*

654
*   Deprecate `:disable_with` in favor of `data: { disable_with: "Text" }` option from `submit_tag`, `button_tag` and `button_to` helpers.
655 656 657

    *Carlos Galdino + Rafael Mendonça França*

658 659 660
*   Remove `:mouseover` option from `image_tag` helper. *Rafael Mendonça França*

*   The `select` method (select tag) forces :include_blank  if `required` is true and
661 662
    `display size` is one and `multiple` is not true. *Angelo Capilleri*

663 664 665 666 667
*   Copy literal route constraints to defaults so that url generation know about them.
    The copied constraints are `:protocol`, `:subdomain`, `:domain`, `:host` and `:port`.

    *Andrew White*

J
José Valim 已提交
668 669 670 671
*   `respond_to` and `respond_with` now raise ActionController::UnknownFormat instead
    of directly returning head 406. The exception is rescued and converted to 406
    in the exception handling middleware. *Steven Soroka*

672 673
*   Allows `assert_redirected_to` to match against a regular expression. *Andy Lindeman*

S
Santiago Pastorino 已提交
674 675
*   Add backtrace to development routing error page. *Richard Schneeman*

676
*   Replace `include_seconds` boolean argument with `include_seconds: true` option
677 678
    in `distance_of_time_in_words` and `time_ago_in_words` signature. *Dmitriy Kiriyenko*

679 680 681
*   Make current object and counter (when it applies) variables accessible when
    rendering templates with :object / :collection. *Carlos Antonio da Silva*

J
Jo Liss 已提交
682
*   JSONP now uses mimetype text/javascript instead of application/json. *omjokine*
683

684 685
*   Allow to lazy load `default_form_builder` by passing a `String` instead of a constant. *Piotr Sarnacki*

686 687 688 689 690 691 692
*   Session arguments passed to `process` calls in functional tests are now merged into
    the existing session, whereas previously they would replace the existing session.
    This change may break some existing tests if they are asserting the exact contents of
    the session but should not break existing tests that only assert individual keys.

    *Andrew White*

693 694
*   Add `index` method to FormBuilder class. *Jorge Bejar*

695 696
*   Remove the leading \n added by textarea on assert_select. *Santiago Pastorino*

697 698 699
*   Changed default value for `config.action_view.embed_authenticity_token_in_remote_forms`
    to `false`. This change breaks remote forms that need to work also without javascript,
    so if you need such behavior, you can either set it to `true` or explicitly pass
700
    `authenticity_token: true` in form options
701

702 703
*   Added ActionDispatch::SSL middleware that when included force all the requests to be under HTTPS protocol. *Rafael Mendonça França*

704
*   Add `include_hidden` option to select tag. With `include_hidden: false` select with `multiple` attribute doesn't generate hidden input with blank value. *Vasiliy Ermolovich*
705

706 707 708 709
*   Removed default `size` option from the `text_field`, `search_field`, `telephone_field`, `url_field`, `email_field` helpers. *Philip Arndt*

*   Removed default `cols` and `rows` options from the `text_area` helper. *Philip Arndt*

710
*   Adds support for layouts when rendering a partial with a given collection. *serabe*
711

712
*   Allows the route helper `root` to take a string argument. For example, `root 'pages#main'`. *bcardarella*
713

714
*   Forms of persisted records use always PATCH (via the `_method` hack). *fxn*
715

716
*   For resources, both PATCH and PUT are routed to the `update` action. *fxn*
717

718 719 720
*   Don't ignore `force_ssl` in development. This is a change of behavior - use a `:if` condition to recreate the old behavior.

        class AccountsController < ApplicationController
721
          force_ssl if: :ssl_configured?
722 723 724 725 726 727 728 729

          def ssl_configured?
            !Rails.env.development?
          end
        end

    *Pat Allan*

730 731 732 733 734 735 736 737 738 739 740
*   Adds support for the PATCH verb:
      * Request objects respond to `patch?`.
      * Routes have a new `patch` method, and understand `:patch` in the
        existing places where a verb is configured, like `:via`.
      * New method `patch` available in functional tests.
      * If `:patch` is the default verb for updates, edits are
        tunneled as PATCH rather than as PUT, and routing acts accordingly.
      * New method `patch_via_redirect` available in integration tests.

    *dlee*

741 742
*   Integration tests support the `OPTIONS` method. *Jeremy Kemper*

743 744 745
*   `expires_in` accepts a `must_revalidate` flag. If true, "must-revalidate"
    is added to the Cache-Control header. *fxn*

746 747
*   Add `date_field` and `date_field_tag` helpers which render an `input[type="date"]` tag *Olek Janiszewski*

748 749 750 751
*   Adds `image_url`, `javascript_url`, `stylesheet_url`, `audio_url`, `video_url`, and `font_url`
    to assets tag helper. These URL helpers will return the full path to your assets. This is useful
    when you are going to reference this asset from external host. *Prem Sichanugrist*

752 753
*   Default responder will now always use your overridden block in `respond_with` to render your response. *Prem Sichanugrist*

754 755 756 757 758 759 760 761 762 763
*   Allow `value_method` and `text_method` arguments from `collection_select` and
    `options_from_collection_for_select` to receive an object that responds to `:call`,
    such as a `proc`, to evaluate the option in the current element context. This works
    the same way with `collection_radio_buttons` and `collection_check_boxes`.

    *Carlos Antonio da Silva + Rafael Mendonça França*

*   Add `collection_check_boxes` form helper, similar to `collection_select`:
    Example:

764 765 766 767 768 769 770
        collection_check_boxes :post, :author_ids, Author.all, :id, :name
        # Outputs something like:
        <input id="post_author_ids_1" name="post[author_ids][]" type="checkbox" value="1" />
        <label for="post_author_ids_1">D. Heinemeier Hansson</label>
        <input id="post_author_ids_2" name="post[author_ids][]" type="checkbox" value="2" />
        <label for="post_author_ids_2">D. Thomas</label>
        <input name="post[author_ids][]" type="hidden" value="" />
771 772 773 774 775 776 777 778

    The label/check_box pairs can be customized with a block.

    *Carlos Antonio da Silva + Rafael Mendonça França*

*   Add `collection_radio_buttons` form helper, similar to `collection_select`:
    Example:

779 780 781 782 783 784
        collection_radio_buttons :post, :author_id, Author.all, :id, :name
        # Outputs something like:
        <input id="post_author_id_1" name="post[author_id]" type="radio" value="1" />
        <label for="post_author_id_1">D. Heinemeier Hansson</label>
        <input id="post_author_id_2" name="post[author_id]" type="radio" value="2" />
        <label for="post_author_id_2">D. Thomas</label>
785 786 787 788 789

    The label/radio_button pairs can be customized with a block.

    *Carlos Antonio da Silva + Rafael Mendonça França*

790
*   `check_box` with `:form` html5 attribute will now replicate the `:form`
791 792
    attribute to the hidden field as well. *Carlos Antonio da Silva*

793 794 795
*   Turn off verbose mode of rack-cache, we still have X-Rack-Cache to
    check that info. Closes #5245. *Santiago Pastorino*

796
*   `label` form helper accepts `for: nil` to not generate the attribute. *Carlos Antonio da Silva*
797

798
*   Add `:format` option to `number_to_percentage`. *Rodrigo Flores*
799

800
*   Add `config.action_view.logger` to configure logger for Action View. *Rafael Mendonça França*
801

802
*   Deprecated `ActionController::Integration` in favour of `ActionDispatch::Integration`.
803

804
*   Deprecated `ActionController::IntegrationTest` in favour of `ActionDispatch::IntegrationTest`.
805

806
*   Deprecated `ActionController::PerformanceTest` in favour of `ActionDispatch::PerformanceTest`.
807

808
*   Deprecated `ActionController::AbstractRequest` in favour of `ActionDispatch::Request`.
809

810
*   Deprecated `ActionController::Request` in favour of `ActionDispatch::Request`.
811

812
*   Deprecated `ActionController::AbstractResponse` in favour of `ActionDispatch::Response`.
813

814
*   Deprecated `ActionController::Response` in favour of `ActionDispatch::Response`.
815

816
*   Deprecated `ActionController::Routing` in favour of `ActionDispatch::Routing`.
817

818
*   `check_box helper` with `disabled: true` will generate a disabled
819 820 821
    hidden field to conform with the HTML convention where disabled fields are
    not submitted with the form. This is a behavior change, previously the hidden
    tag had a value of the disabled checkbox. *Tadas Tamosauskas*
822

823 824
*   `favicon_link_tag` helper will now use the favicon in app/assets by default. *Lucas Caton*

825 826
*   `ActionView::Helpers::TextHelper#highlight` now defaults to the
    HTML5 `mark` element. *Brian Cardarella*
827

X
Xavier Noria 已提交
828
Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md) for previous changes.