CHANGELOG.md 13.7 KB
Newer Older
G
v6.0.1  
George Claghorn 已提交
1
## Rails 6.0.1 (November 5, 2019) ##
G
George Claghorn 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

*   The `zeitwerk:check` Rake task reports files outside the app's root
    directory, as in engines loaded from gems.

    *Xavier Noria*

*   Fixed a possible error when using the evented file update checker.

    *Yuji Yaginuma*

*   The sqlite3 database files created by the parallel testing feature are
    included in the default `.gitignore` file for newly-generated apps.

    *Yasuo Honda*

*   `rails new` generates a `.keep` file in `tmp/pids`. This fixes starting
    a server via `rackup` instead of `rails server`.

    *Rafael Mendonça França*


23
## Rails 6.0.0 (August 16, 2019) ##
24

X
Xavier Noria 已提交
25 26
*   `Rails.autoloaders.log!` is a logging shortcut to get the activity of the
    loaders printed to standard output. May be handy for troubleshooting.
27

X
Xavier Noria 已提交
28
    *Xavier Noria*
29

30

X
Xavier Noria 已提交
31
## Rails 6.0.0.rc2 (July 22, 2019) ##
32 33 34 35 36 37 38

*   The new configuration point `config.add_autoload_paths_to_load_path` allows
    users to opt-out from adding autoload paths to `$LOAD_PATH`. This flag is
    `true` by default, but it is recommended to be set to `false` in `:zeitwerk`
    mode early, in `config/application.rb`.

    Zeitwerk uses only absolute paths internally, and applications running in
X
Xavier Noria 已提交
39
    `:zeitwerk` mode do not need `require_dependency`, so models, controllers,
40 41 42 43 44 45 46
    jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves
    Ruby from checking these directories when resolving `require` calls with
    relative paths, and saves Bootsnap work and RAM, since it does not need to
    build an index for them.

    *Xavier Noria*

47 48
## Rails 6.0.0.rc1 (April 24, 2019) ##

49 50 51 52 53 54 55 56 57 58 59
*   Applications upgrading to Rails 6 can run the command

    ```
    bin/rails zeitwerk:check
    ```

    to check if the project structure they were using with the classic
    autoloader is compatible with `:zeitwerk` mode.

    *Matilda Smeds* & *Xavier Noria*

60 61 62 63 64 65
*   Allow loading seeds without ActiveJob.

    Fixes #35782

    *Jeremy Weathers*

66 67 68 69 70 71 72
*   `null: false` is set in the migrations by default for column pointed by
    `belongs_to` / `references` association generated by model generator.

    Also deprecate passing {required} to the model generator.

    *Prathamesh Sonpatki*

73 74 75 76 77
*   New applications get `config.cache_classes = false` in `config/environments/test.rb`
    unless `--skip-spring`.

    *Xavier Noria*

78 79 80 81
*   Autoloading during initialization is deprecated.

    *Xavier Noria*

82 83 84 85
*   Only force `:async` ActiveJob adapter to `:inline` during seeding.

    *BatedUrGonnaDie*

86 87 88 89 90
*   The `connection` option of `rails dbconsole` command is deprecated in
    favor of `database` option.

    *Yuji Yaginuma*

C
Connor Shea 已提交
91
*   Replace `chromedriver-helper` gem with `webdrivers` in default Gemfile.
92 93
    `chromedriver-helper` is deprecated as of March 31, 2019 and won't
    receive any further updates.
C
Connor Shea 已提交
94 95 96

    *Guillermo Iguaran‮*

X
Xavier Noria 已提交
97 98 99 100 101
*   Applications running in `:zeitwerk` mode that use `bootsnap` need
    to upgrade `bootsnap` to at least 1.4.2.

    *Xavier Noria*

102 103 104
*   Add `config.disable_sandbox` option to Rails console.

    This setting will disable `rails console --sandbox` mode, preventing
105
    developer from accidentally starting a sandbox console,
106
    which when left inactive, can cause the database server to run out of memory.
107 108 109

    *Prem Sichanugrist*

110 111 112 113
*   Add `-e/--environment` option to `rails initializers`.

    *Yuji Yaginuma*

114

E
eileencodes 已提交
115 116
## Rails 6.0.0.beta3 (March 11, 2019) ##

117 118 119 120 121 122 123 124 125 126 127
*   Generate random development secrets

    A random development secret is now generated to tmp/development_secret.txt

    This avoids an issue where development mode servers were vulnerable to
    remote code execution.

    Fixes CVE-2019-5420

    *Eileen M. Uchitelle*, *Aaron Patterson*, *John Hawthorn*

E
eileencodes 已提交
128

129 130
## Rails 6.0.0.beta2 (February 25, 2019) ##

131 132 133 134 135
*   Fix non-symbol access to nested hashes returned from `Rails::Application.config_for`
    being broken by allowing non-symbol access with a deprecation notice.

    *Ufuk Kayserilioglu*

136 137 138 139 140
*   Fix deeply nested namespace command printing.

    *Gannon McGibbon*


141 142
## Rails 6.0.0.beta1 (January 18, 2019) ##

143 144 145 146
*   Remove deprecated `after_bundle` helper inside plugins templates.

    *Rafael Mendonça França*

147 148 149 150
*   Remove deprecated support to old `config.ru` that use the application class as argument of `run`.

    *Rafael Mendonça França*

151 152 153 154
*   Remove deprecated `environment` argument from the rails commands.

    *Rafael Mendonça França*

155 156 157 158
*   Remove deprecated `capify!`.

    *Rafael Mendonça França*

159 160 161 162
*   Remove deprecated `config.secret_token`.

    *Rafael Mendonça França*

163 164 165 166
*   Seed database with inline ActiveJob job adapter.

    *Gannon McGibbon*

167 168 169 170 171 172 173 174
*   Add `rails db:system:change` command for changing databases.

    ```
    bin/rails db:system:change --to=postgresql
       force  config/database.yml
        gsub  Gemfile
    ```

175 176 177
    The change command copies a template `config/database.yml` with
    the target database adapter into your app, and replaces your database gem
    with the target database gem.
178 179 180

    *Gannon McGibbon*

B
bogdanvlviv 已提交
181 182 183 184
*   Add `rails test:channels`.

    *bogdanvlviv*

185 186 187 188
*   Use original `bundler` environment variables during the process of generating a new rails project.

    *Marco Costa*

189 190 191 192 193 194 195 196
*   Send Active Storage analysis and purge jobs to dedicated queues by default.

    Analysis jobs now use the `:active_storage_analysis` queue, and purge jobs
    now use the `:active_storage_purge` queue. This matches Action Mailbox,
    which sends its jobs to dedicated queues by default.

    *George Claghorn*

197 198 199 200
*   Add `rails test:mailboxes`.

    *George Claghorn*

201
*   Introduce guard against DNS rebinding attacks.
202

203
    The `ActionDispatch::HostAuthorization` is a new middleware that prevents
204 205 206 207 208 209 210 211 212 213 214
    against DNS rebinding and other `Host` header attacks. It is included in
    the development environment by default with the following configuration:

        Rails.application.config.hosts = [
          IPAddr.new("0.0.0.0/0"), # All IPv4 addresses.
          IPAddr.new("::/0"),      # All IPv6 addresses.
          "localhost"              # The localhost reserved domain.
        ]

    In other environments `Rails.application.config.hosts` is empty and no
    `Host` header checks will be done. If you want to guard against header
215
    attacks on production, you have to manually permit the allowed hosts
216 217 218 219 220
    with:

        Rails.application.config.hosts << "product.com"

    The host of a request is checked against the `hosts` entries with the case
221
    operator (`#===`), which lets `hosts` support entries of type `Regexp`,
222 223 224 225 226 227
    `Proc` and `IPAddr` to name a few. Here is an example with a regexp.

        # Allow requests from subdomains like `www.product.com` and
        # `beta1.product.com`.
        Rails.application.config.hosts << /.*\.product\.com/

228
    A special case is supported that allows you to permit all sub-domains:
229 230 231 232 233 234 235

        # Allow requests from subdomains like `www.product.com` and
        # `beta1.product.com`.
        Rails.application.config.hosts << ".product.com"

    *Genadi Samokovarov*

236 237 238 239
*   Remove redundant suffixes on generated helpers.

    *Gannon McGibbon*

240 241 242 243
*   Remove redundant suffixes on generated integration tests.

    *Gannon McGibbon*

244 245 246 247
*   Fix boolean interaction in scaffold system tests.

    *Gannon McGibbon*

248 249 250 251
*   Remove redundant suffixes on generated system tests.

    *Gannon McGibbon*

252 253 254 255 256 257
*   Add an `abort_on_failure` boolean option to the generator method that shell
    out (`generate`, `rake`, `rails_command`) to abort the generator if the
    command fails.

    *David Rodríguez*

258 259 260 261
*   Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.

    *Gannon McGibbon*

262 263
*   Use Ids instead of memory addresses when displaying references in scaffold views.

264 265 266 267
    Fixes #29200.

    *Rasesh Patel*

268 269 270 271 272
*   Adds support for multiple databases to `rails db:migrate:status`.
    Subtasks are also added to get the status of individual databases (eg. `rails db:migrate:status:animals`).

    *Gannon McGibbon*

273 274 275 276 277 278 279 280
*   Use Webpacker by default to manage app-level JavaScript through the new app/javascript directory.
    Sprockets is now solely in charge, by default, of compiling CSS and other static assets.
    Action Cable channel generators will create ES6 stubs rather than use CoffeeScript.
    Active Storage, Action Cable, Turbolinks, and Rails-UJS are loaded by a new application.js pack.
    Generators no longer generate JavaScript stubs.

    *DHH*, *Lachlan Sylvester*

281 282 283
*   Add `database` (aliased as `db`) option to model generator to allow
    setting the database. This is useful for applications that use
    multiple databases and put migrations per database in their own directories.
284 285

    ```
286
    bin/rails g model Room capacity:integer --database=kingston
287 288 289 290 291
          invoke  active_record
          create    db/kingston_migrate/20180830151055_create_rooms.rb
    ```

    Because rails scaffolding uses the model generator, you can
292
    also specify a database with the scaffold generator.
293 294 295

    *Gannon McGibbon*

296
*   Raise an error when "recyclable cache keys" are being used by a cache store
297 298 299
    that does not explicitly support it. Custom cache keys that do support this feature
    can bypass this error by implementing the `supports_cache_versioning?` method on their
    class and returning a truthy value.
300 301 302

    *Richard Schneeman*

303
*   Support environment specific credentials overrides.
304

305 306 307 308 309 310
    So any environment will look for `config/credentials/#{Rails.env}.yml.enc` and fall back
    to `config/credentials.yml.enc`.

    The encryption key can be in `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`.

    Environment credentials overrides can be edited with `rails credentials:edit --environment production`.
311
    If no override is set up for the passed environment, it will be created.
312 313

    Additionally, the default lookup paths can be overwritten with these configs:
314

315 316
    - `config.credentials.content_path`
    - `config.credentials.key_path`
317 318 319

    *Wojciech Wnętrzak*

320
*   Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
321 322 323

    *Michael C. Nelson*

324 325 326 327
*   Emit warning for unknown inflection rule when generating model.

    *Yoshiyuki Kinjo*

328
*   Add `database` (aliased as `db`) option to migration generator.
329 330 331

    If you're using multiple databases and have a folder for each database
    for migrations (ex db/migrate and db/new_db_migrate) you can now pass the
332
    `--database` option to the generator to make sure the the migration
333 334 335
    is inserted into the correct folder.

    ```
336
    rails g migration CreateHouses --database=kingston
337 338 339 340 341 342
      invoke  active_record
      create    db/kingston_migrate/20180830151055_create_houses.rb
    ```

    *Eileen M. Uchitelle*

343 344 345 346
*   Deprecate `rake routes` in favor of `rails routes`.

    *Yuji Yaginuma*

347 348 349 350
*   Deprecate `rake initializers` in favor of `rails initializers`.

    *Annie-Claude Côté*

351 352 353 354
*   Deprecate `rake dev:cache` in favor of `rails dev:cache`.

    *Annie-Claude Côté*

355 356 357
*   Deprecate `rails notes` subcommands in favor of passing an `annotations` argument to `rails notes`.

    The following subcommands are replaced by passing `--annotations` or `-a` to `rails notes`:
358 359 360 361
    - `rails notes:custom ANNOTATION=custom` is deprecated in favor of using `rails notes -a custom`.
    - `rails notes:optimize` is deprecated in favor of using `rails notes -a OPTIMIZE`.
    - `rails notes:todo` is deprecated in favor of  using`rails notes -a TODO`.
    - `rails notes:fixme` is deprecated in favor of using `rails notes -a FIXME`.
362 363 364 365 366 367 368 369 370 371 372 373

    *Annie-Claude Côté*

*   Deprecate `SOURCE_ANNOTATION_DIRECTORIES` environment variable used by `rails notes`
    through `Rails::SourceAnnotationExtractor::Annotation` in favor of using `config.annotations.register_directories`.

    *Annie-Claude Côté*

*   Deprecate `rake notes` in favor of `rails notes`.

    *Annie-Claude Côté*

R
Ryuta Kamizono 已提交
374
*   Don't generate unused files in `app:update` task.
375

R
Ryuta Kamizono 已提交
376
    Skip the assets' initializer when sprockets isn't loaded.
377

R
Ryuta Kamizono 已提交
378
    Skip `config/spring.rb` when spring isn't loaded.
379

R
Ryuta Kamizono 已提交
380
    Skip yarn's contents when yarn integration isn't used.
381

382 383
    *Tsukuru Tanimichi*

384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
*   Make the master.key file read-only for the owner upon generation on
    POSIX-compliant systems.

    Previously:

        $ ls -l config/master.key
        -rw-r--r--   1 owner  group      32 Jan 1 00:00 master.key

    Now:

        $ ls -l config/master.key
        -rw-------   1 owner  group      32 Jan 1 00:00 master.key

    Fixes #32604.

    *Jose Luis Duran*

401
*   Deprecate support for using the `HOST` environment variable to specify the server IP.
402

403
    The `BINDING` environment variable should be used instead.
404 405 406 407 408

    Fixes #29516.

    *Yuji Yaginuma*

409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
*   Deprecate passing Rack server name as a regular argument to `rails server`.

    Previously:

        $ bin/rails server thin

    There wasn't an explicit option for the Rack server to use, now we have the
    `--using` option with the `-u` short switch.

    Now:

        $ bin/rails server -u thin

    This change also improves the error message if a missing or mistyped rack
    server is given.

    *Genadi Samokovarov*

427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
*   Add "rails routes --expanded" option to output routes in expanded mode like
    "psql --expanded". Result looks like:

    ```
    $ rails routes --expanded
    --[ Route 1 ]------------------------------------------------------------
    Prefix            | high_scores
    Verb              | GET
    URI               | /high_scores(.:format)
    Controller#Action | high_scores#index
    --[ Route 2 ]------------------------------------------------------------
    Prefix            | new_high_score
    Verb              | GET
    URI               | /high_scores/new(.:format)
    Controller#Action | high_scores#new
    ```

    *Benoit Tigeot*

K
Kasper Timm Hansen 已提交
446
*   Rails 6 requires Ruby 2.5.0 or newer.
J
Jeremy Daer 已提交
447

K
Kasper Timm Hansen 已提交
448
    *Jeremy Daer*, *Kasper Timm Hansen*
J
Jeremy Daer 已提交
449 450


451
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/railties/CHANGELOG.md) for previous changes.