Performance improvements, configuration options, and more

Greetings! Daniel here, reporting from Brooklyn, NY.

Use faster globs for template resolving

Resolving templates used to get pretty slow as the number of view paths, handlers, and formats increased. Replacing 1682 system calls with 14 sounds pretty great to me!

Do less work and use less memory

2.4% faster, 1.7% faster, 1.58% faster. Many thanks to Richard for working hard so our applications don’t need to!

Improve performance of Integer#multiple_of?

With a few clever tweaks, it has never been easier to find out if 4611686018427387903 is a multiple of 42.

Default to utf8mb4 for MySQL

The previous default character set did not support supplemental characters like emoji. The 4-Byte utf8mb4 has you covered. 👍 

Introduce model-level configuration for filtering sensitive attributes

Nobody wants sensitive data to show up in logs. The new filter_attributes setting allows you to filter out sensitive attributes when calling a model’s inspect method.

Introduce configurable prefix for Active Storage routes

By default the Active Storage routes begin with
/rails/active_storage. If that doesn’t suit you, you can now use any scope you like by setting config.active_storage.routes_prefix in your application config.

Include an id in Action Cable’s Redis configuration

Action Cable now passes an id to Redis, which can help you distinguish between Action Cable’s connection and any other connections you might have.

44 people contributed to Rails over the past two weeks. Check out the full list of changes. If you are interested in helping out, we have plenty of open issues. I hope to see your name on the list next week!

Read replica database configurations, faster parameter filtering, and more!

Hello everyone! This is Eugene, bringing you the highlights from the last week of activity in the Rails codebase.

Add hooks to Active Job on retries and discards

Your application can now subscribe to be notified whenever a job is retried or discarded. Neat!

Support read replica database configurations

Database configurations can now be flagged as “replicas”, indicating that the database they connect to is read-only.

For now this just means they’re ignored by database tasks like db:create, but the comments on the pull request mention some other features that could be built on top of this change.

Reduce allocations during parameter filtering

Initially this patch looked like a micro-optimisation, but the author produced a benchmark which demonstrated saving 1% of both memory and time on a real world Rails app.

Find inverse associations with plural names

Previously, inverse associations would only be detected when they matched the model name exactly. Now, the case where they use the plural form of the model name will work too.

Clear mutation tracker after yielding in around callbacks

This change ensures that a record’s view of the database is up to date immediately after an around callback yields, just as it would be in an after callback.

21 people contributed to Rails this week; feel free to check out the full list of changes. If you want help out, maybe look for an interesting open issue?

Until next time!

Action Cable testing utilities, bugfixes and more!

Happy Sunday! This is Greg bringing you the latest news about Rails.

The initializers Rake task is moved to Rails::Command

Another Rake task is moved to Rails::Command, so in Rails 6 you will need to call bin/rails initializers instead of bin/rake initializers.

Improve Active Job test helpers

This change adds a queue option to perform_enqueued_jobs, and if it is set, only the specified queue will be performed.

Fix rails routes -c

This PR fixes the issue of rails routes -c UserPermissionsController did not output routes for the corresponding controller, because its name consists of multiple words. 

Action Cable testing

This PR is basically a merge of the actioncable-testing gem into Rails, to provide testing utilities for Action Cable.

Fail more gracefully from Active Storage missing file exceptions

This PR translates service-specific missing object exceptions into one generic ActiveStorage::FileNotFoundError, so the application can fail more gracefully when a missing file is accessed.

Omit BEGIN/COMMIT statements for empty transactions

With this change, if a transaction is opened and closed without any queries being run, the BEGIN and COMMIT statements are omitted to remove the overhead, and make workarounds like save if changed? unnecessary.

Support multiple submit buttons in Active Storage forms

Often times forms have more than one submit button enabling different actions, but before this change, Active Storage used the first submit button of the form, rather than the one the user actually clicked.

28 people contributed to Rails this week. If you also want help out, check out the list of open issues! Until next time!

Cookies with purpose, Array extract! and more

Welcome in this week news edition from Rails world. This is Wojtek bringing you summary of latest activities.

Once Webpacker is the default in rails/master, we’ll be unveiling the alpha version of a brand-new exciting framework for Rails 6.0 😄.

If you can’t wait, help us testing Webpacker integration so it can be merged and mystery revealed.

Add Purpose Metadata to Cookies

Adds purpose metadata to cookies so that the value of one cookie cannot be copied and used as the value of another cookie.

Add Array#extract!

The method removes and returns the elements for which the block returns a true value.

numbers = [1, 2, 3, 4]
odd_numbers = numbers.extract!(&:odd?) # => [1, 3]
numbers # => [2, 4]

Replace rake dev:cache with Rails command

Rake task is now deprecated in favor of “rails dev:cache”

24 people contributed to Rails this week. You can see all the changes here.
Until next time!

Rails 5.2.1, skip caching nil entries and more

Namaste everyone! This is Prathamesh bringing you the latest news from the Rails world with some rain and chai from Pune.

Rails 5.2.1 is out in the wild

Rails 5.2.1 is released. Give it a try and check out all the awesome features.

Better error handling of Active Storage adapters

Now, the Active Storage service adapter names can be lower case or upper case. Also, a nice error message is printed if the service adapter class can’t be loaded.

Support for skipping caching of nil entries

While caching data from external services, sometimes we may get nil values. Most probably we don’t want to cache them. Here is an option skip_nil: true/false to skip caching of such entries.

Fix the issue of build not getting called on extension for has_many association

Earlier, the extended build method was not called properly for the has_many association which was being accepted by using accepts_nested_attributes_for.

This issue is fixed now.

19 people contributed to Rails this week. Four of them contributed for the first time! Do you also want to join them? There might be some open issues you can try tackling?

See all the changes  from last week here and stay tuned for next week. 👋

Rails 5.2.1 has been released!

Hi everyone,

I am happy to announce that Rails 5.2.1 has been released.

CHANGES since 5.2.0

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.2.1:

$ shasum -a 256 *-5.2.1.gem
ce0d3cf1c76afd3a2f8a751542e2ddfe48cf4005d426a09775b944a780ed6d9f  actioncable-5.2.1.gem
a667ecf76d300a8faebc5125c25ddb4e46d9c96496c206eee7e02a79c8c33640  actionmailer-5.2.1.gem
8eb8407ad4c836c46285720b05fa7600bec0327fddc3127b43edf2987a4cfba7  actionpack-5.2.1.gem
ae45abf777e829e31c6d3a66f43ed792a657b91fe9b5f322f1f63e7bb4b4aa37  actionview-5.2.1.gem
79383a8dad75cf39677a0096109fc9dcf61cfcf1ef39aeddf2347486c03f94d4  activejob-5.2.1.gem
a45939b9b0e23225d81786519dda2f1ba9f1568012682aa344d8b1e154b77610  activemodel-5.2.1.gem
ef3c520c782d5e51ee67231d4b6167db0166d4b451d0c835e0577eb89967875d  activerecord-5.2.1.gem
4ff9bba1a317bfbc5cd9349bb4e00f6e0aff76d237d68a71ad524b92e0c8cc72  activestorage-5.2.1.gem
829a480f2cf3747b5e94429d983dfb1645a27d506b365642d08ecc3066373e7e  activesupport-5.2.1.gem
776cfea45140972f1780236748f7cfe72cf95c032056812128433273c366078c  rails-5.2.1.gem
1ba71ee5ec7d85567f9984df1dae2eb7e6c8c2855e6b810582719fb5db20c3a7  railties-5.2.1.gem

As always, huge thanks to the many contributors who helped with this release.

Rails 5.2.1.rc1, faster parallel testing and more

Hello everyone! This is Roque, with the latest news about Ruby on Rails!

Help test Rails 5.2.1.rc1

Help us test this release candidate to have a solid and stable 5.2.1.

Faster parallel testing

Instead of running database migrations for each set of tests, Rails will load the schema to improve performance.

Raises exception when respond_to is called multiple times

An exception will be raised when respond_to is called multiple times in an incompatible way. For example, when the Content-Type values do not match.

Set a default Content-Type for the method head

The method head will have Content-Type as text/html when one is not provided.

Fix the IP address logged by Rails

It will now log the remote IP address of clients behind a proxy instead of the IP of the proxy itself.

23 people contributed to Rails this week. You can see all the changes here. There might be some open issues you can try tackling?

Stay tuned!

Rails 5.2.1.rc1 has been released!

Hi everyone,

I am happy to announce that Rails 5.2.1.rc1 has been released.

If no regressions are found, expect the final release on Monday, August 6, 2018. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 5.2.0

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.2.1.rc1:

$ shasum -a 256 *-5.2.1.rc1.gem
cf26a51b6483ce88c352687207557825b5ce22d45276f7b4f1168ef71275c5bb  actioncable-5.2.1.rc1.gem
733f8e2aa203ef83c1bcbc0ffa316b9fafeac8ea5c95dbfc41ec4af440fb8466  actionmailer-5.2.1.rc1.gem
9858e240e67a35fcfed8d87673ec496d3d2bd970d00fd6414d922772bed06460  actionpack-5.2.1.rc1.gem
cf68f757d8d71aee003889d8fd49a9f44d0ed348cd07a3ab34c953310f785565  actionview-5.2.1.rc1.gem
ad4575d404c1339c3782ad55976ab40b123e8217fbebfffc579e56f91b7c9bf1  activejob-5.2.1.rc1.gem
e1ee68dd9a8e659cbc523a1d0972b8fc4344ecab5a85aec7a7280d33a66076a4  activemodel-5.2.1.rc1.gem
e184d5b709e0e8351fa32485f63353272a41505b1dbf30c6034a60be321804b1  activerecord-5.2.1.rc1.gem
04b99f581620933447f10e0e9f8964863994962b3c4580e8c0103b9e3bd5ee18  activestorage-5.2.1.rc1.gem
f19afc75fa8527b850b12c343cd4e94b7d4d81f0de7126b03912db591789e167  activesupport-5.2.1.rc1.gem
78fbe88491b0a68f9fe68d7dd8594e2bc102c1aed99a5c5e8acca87e2ec914e7  rails-5.2.1.rc1.gem
a17f0d61e8da7970c19b98f95196d27115be7603a9badfedccd1329b2daffc93  railties-5.2.1.rc1.gem

As always, huge thanks to the many contributors who helped with this release.

Better instrumentation, enhanced Postgres helpers and more

Hello from London! The heatwave is finally over and we can get back to 🌧. This is Kir, bringing you the latest Rails updates.

Add cpu time, idle time, and allocations features to log subscriber events

The change makes it much easier to instrument CPU time and object allocations with ActiveSupport::Notifications events.

Prefer rails command over bin/rails

In some files we recommended using rails, in others bin/rails. The inconsistency is now fixed 🎉

Why prefer rails as the recommended executable? It does all the heavy lifting of dispatching to the app appropriate Rails version, so that’s why users don’t need to target bin/rails manually.

PostgreSQL 10 new relkind for partitioned tables

The PR brings support for Postgres’ partitioned tables to create_table helper.

Add strict argument checking to Active Record callbacks

Callbacks like before_save will now raise when they receive unsupported arguments.

26 people contributed to Rails this week. You can see all the changes here. There might be some open issues you can try tackling?

Stay tuned!

Attaching files on save, Rails notes and more

Hello Ruby fans. This is Wojtek bringing you latest news from World Cup fields.
I mean Ruby on Rails codebase…

Support readonly option in SQLite3

To ensure no modifications are allowed on SQLite3 database you can now pass “readonly” option.

Support “_html” suffix for array in translations

Now in HTML safe translation key, you can use array of values that will not be escaped in the view.

Change “rails notes” to use Rails command

Previously it was using Rake task under the hood. Now it’s a pure command. Old “rails notes ANNOTATION=custom” becomes “rails notes –annotations custom”. Old syntax will continue to work outputting a deprecation message.

Store newly-uploaded files on save rather than assignment

Active Storage will now store attachables assigned to a record after the record is saved rather than immediately. This will help in supporting validations before persisting the file.

Allow to explicitly specify whether to output Rails’s log to stdout

New option “–log-to-stdout” was added to “rails server” command. Enabled by default in development when not daemonized (as it was before).

25 people contributed to Rails this past 2 weeks when not watching World Cup. You can see all the changes here.

Let’s wish ourselves a great final game on Sunday. Until next week!