1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/CHANGELOG.md

199 lines
6.6 KiB
Markdown
Raw Normal View History

* Use Ids instead of memory addresses when displaying references in scaffold views.
Fixes #29200.
*Rasesh Patel*
* 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*
Make Webpacker the default JavaScript compiler for Rails 6 (#33079) * Use Webpacker by default on new apps * Stop including coffee-rails by default * Drop using a js_compressor by default * Drop extra test for coffeescript inclusion by default * Stick with skip_javascript to signify skipping webpack * Don't install a JS runtime by default any more * app/javascript will be the new default directory for JS * Make it clear that this is just for configuring the default Webpack framework setup now * Start using the Webpack tag in the default layout * Irrelevant test * jQuery is long gone * Stop having asset pipeline compile default application.js * Add rails-ujs by default to the Webpack setup * Add Active Storage JavaScript to application.js pack by default * Consistent quoting * Add Turbolinks to default pack * Add Action Cable to default pack Need some work on how to set the global consumer that channels will work with. @javan? * Require all channels by default and use a separate consumer stub * Channel generator now targets Webpack style * Update task docs to match new generator style * Use uniform import style * Drop the JS assets generator It was barely helpful as it was. It’s no longer helpful in a Webpacked world. Sayonara! * Add app/javascript to the stats directories * Simpler import style Which match the other imports. * Address test failures from dropping JS compilation (and compression) * webpacker-default: Modify `AssetsGeneratorTest` Before: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 46201 F Failure: AssetsGeneratorTest#test_assets [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:12]: Expected file "app/assets/javascripts/posts.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:10 . Finished in 0.031343s, 63.8101 runs/s, 95.7152 assertions/s. 2 runs, 3 assertions, 1 failures, 0 errors, 0 skips ``` After: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 43571 .. Finished in 0.030370s, 65.8545 runs/s, 65.8545 assertions/s. 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips ``` * webpacker-default: Modify `ChannelGeneratorTest` Before: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 8986 .F Failure: ChannelGeneratorTest#test_channel_with_multiple_actions_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:43]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:34 .F Failure: ChannelGeneratorTest#test_channel_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:29]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:22 E Error: ChannelGeneratorTest#test_cable_js_is_created_if_not_present_already: Errno::ENOENT: No such file or directory @ apply2files - /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/fixtures/tmp/app/assets/javascripts/cable.js bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:60 F Failure: ChannelGeneratorTest#test_channel_suffix_is_not_duplicated [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:87]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:80 F Failure: ChannelGeneratorTest#test_channel_on_revoke [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:77]: Expected file "app/assets/javascripts/cable.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:68 Finished in 0.064384s, 108.7227 runs/s, 481.4861 assertions/s. 7 runs, 31 assertions, 4 failures, 1 errors, 0 skips ``` After: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 44857 ....... Finished in 0.060243s, 116.1961 runs/s, 697.1764 assertions/s. 7 runs, 42 assertions, 0 failures, 0 errors, 0 skips ``` * Fix shared generator tests. * webpacker-default: Modify `ControllerGeneratorTest` The JS assets generator was dropped. ref. https://github.com/rails/rails/commit/46215b179483d3e4d264555f5a4952f43eb8142a * Revert "Simpler import style". It's currently failing with an error of "TypeError: undefined is not an object (evaluating '__WEBPACK_IMPORTED_MODULE_2_activestorage___default.a.start')". Waiting for @javan to have a look. This reverts commit 5d3ebb71059f635d3756cbda4ab9752027e09256. * require webpacker in test app * Add webpacker without making the build hang/timeout. (#33640) * use yarn workspaces to allow for installing unreleased packages and only generate js/bootsnap when required * no longer need to have webpacker in env templates as webpacker moved this config to yml file * Fix rubocop violation * Got the test passing for the running scaffold * update expected lines of code * update middleware tests to account for webpacker * disable js in plugins be default to get the tests passing (#34009) * clear codeclimate report issues * Anything newer than currently released is good * Use Webpacker development version during development of Rails * Edge should get development webpacker as well * Add changelog entry for Webpacker change
2018-10-01 01:31:21 -04:00
* 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*
* Refactors `migrations_paths` command option in generators
to `database` (aliased as `db`). Now, the migrations paths
will be read from the specified database configuration in the
current environment.
```
bin/rails g model Chair brand:string --database=kingston
invoke active_record
create db/kingston_migrate/20180830151055_create_chairs.rb
```
`--database` can be used with the migration, model, and scaffold generators.
*Gannon McGibbon*
* Adds an option to the model generator to allow setting the
migrations paths for that migration. This is useful for
applications that use multiple databases and put migrations
per database in their own directories.
```
bin/rails g model Room capacity:integer --migrations-paths=db/kingston_migrate
invoke active_record
create db/kingston_migrate/20180830151055_create_rooms.rb
```
Because rails scaffolding uses the model generator, you can
also specify migrations paths with the scaffold generator.
*Gannon McGibbon*
* Raise an error when "recyclable cache keys" are being used by a cache store
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.
*Richard Schneeman*
* Support environment specific credentials file.
For `production` environment look first for `config/credentials/production.yml.enc` file that can be decrypted by
`ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key` master key.
Edit given environment credentials file by command `rails credentials:edit --environment production`.
Default paths can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.
*Wojciech Wnętrzak*
* Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
*Michael C. Nelson*
* Emit warning for unknown inflection rule when generating model.
*Yoshiyuki Kinjo*
* Add `--migrations_paths` option to migration generator.
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
`--migrations_paths` option to the generator to make sure the the migration
is inserted into the correct folder.
```
rails g migration CreateHouses --migrations_paths=db/kingston_migrate
invoke active_record
create db/kingston_migrate/20180830151055_create_houses.rb
```
*Eileen M. Uchitelle*
* Deprecate `rake routes` in favor of `rails routes`.
*Yuji Yaginuma*
* Deprecate `rake initializers` in favor of `rails initializers`.
*Annie-Claude Côté*
* Deprecate `rake dev:cache` in favor of `rails dev:cache`.
*Annie-Claude Côté*
* 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`:
2018-08-15 07:11:36 -04:00
- `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`.
*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é*
* Don't generate unused files in `app:update` task.
Skip the assets' initializer when sprockets isn't loaded.
Skip `config/spring.rb` when spring isn't loaded.
Skip yarn's contents when yarn integration isn't used.
*Tsukuru Tanimichi*
* 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*
* Deprecate support for using the `HOST` environment to specify the server IP.
The `BINDING` environment should be used instead.
Fixes #29516.
*Yuji Yaginuma*
Introduce explicit rails server handler option I mistype `rails server production` instead of `rails server -e production` expecting to lunch a server in the production environment all the time. However, the signature of `rails server --help` is: ``` Usage: rails server [puma, thin etc] [options] ``` This means that the `production` argument is being interpreted as a Rack server handler like Puma, Thin or Unicorn. Should we argue for the `rails server production`? I'm not sure of the reasons, but the `rails console production` behavior was deprecated in: https://github.com/rails/rails/pull/29358, so parity with the existing `rails console production` usage may not hold anymore. In any case, this PR introduces an explicit option for the Rack servers configuration. The option is called `--using` (or `-u` for short) to avoid the `rails server --server` tantrum. The new interface of `rails server` is: ``` Usage: rails server [using] [options] Options: -p, [--port=port] # Runs Rails on the specified port - defaults to 3000. -b, [--binding=IP] # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'. -c, [--config=file] # Uses a custom rackup configuration. # Default: config.ru -d, [--daemon], [--no-daemon] # Runs server as a Daemon. -e, [--environment=name] # Specifies the environment to run this server under (development/test/production). -u, [--using=name] # Specifies the Rack server used to run the application (thin/puma/webrick). -P, [--pid=PID] # Specifies the PID file. # Default: tmp/pids/server.pid -C, [--dev-caching], [--no-dev-caching] # Specifies whether to perform caching in development. [--early-hints], [--no-early-hints] # Enables HTTP/2 early hints. ``` As a bonus, if you mistype the server to use, you'll get an auto-correction message: ``` $ rails s tin Could not find handler "tin". Maybe you meant "thin" or "cgi"? Run `rails server --help` for more options. ```
2018-02-19 13:31:56 -05:00
* 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*
* 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*
* Rails 6 requires Ruby 2.4.1 or newer.
*Jeremy Daer*
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/railties/CHANGELOG.md) for previous changes.