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.


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.


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!

Redis cache store expiry, faster record instantation and more!

Hey there, detective! Here’s Kasper fumbling through his own trenchcoat for his notebook to give you what went down on the Rails codebase this week.

Redis cache store: increment/decrement expiry

If you’ve been looking to expire a key, either when incrementing or decrementing it, with Rails 5.2s Redis cache store. Just pass _expires_in _to make the key sleep with the fishes.

Guides digging almost too deep

The Rails guides are vast and deep. There’s so many that the digging deeper section almost dug its own grave. But splitting out into another section is a saving grace. Why not look through the current guides?

has_secure_password takes an attribute

For many years has_secure_password only allowed a default password attribute. But now you can stash whatever you want in there.

Reduce record instantiation allocations

Instantiating a list of Active Record objects is now faster and allocates less. If the array has the same instances that is. It’s made possible by not looking up the same STI column each time through the loop. 

OS X ditched for macOS

In lighter documentation news the old Mac OS X spelling has been replaced by macOS where applicable.

Multiple exceptions for retry_on/discard_on

Rails 5.1s syntactic sugar for retry_job, retry_on and discard_on that is, only took one exception so you’d have to duplicate exception blocks or spread a retry on multiple lines. No longer! Get your high in a single line of sugar.

20 people contributed to Rails this past week. There might be some open issues you can try tackling?

See you next week!

Custom year names, plus improvements and bug fixes

Hello, this is Claudio with a quick recap of what changed this week in the source code of Ruby on Rails.

Add year_format option to date_select tag

In Japan, 2000 A.D. is Heisei 12 in Wareki. Other countries like Israel and Thailand also have their own calendars.

date_select now takes a lambda option year_format that can be used to customize year names, e.g.: year_format: ->year { “Heisei #{year - 1988}”.

Support more HTTP cache controls

Add support for the stale-while-revalidate and stale-if-error extensions to the Cache-Control response header. Supporting them will make it easier to utilize reverse proxies and CDNs from Rails without resorting to hacks.

Reduce Memory Allocation when using pluck

This PR optimises ActiveRecord::Result#cast_values to avoid creating temporary arrays, reducing the number of objects allocated to 1 per row retrieved. 
Benchmark show that the new version is up to 1.5x faster.

Permit configuring the default service URL expiry

You can now specify the default expiry of URLs generated by Active Storage by setting config.active_storage.service_urls_expire_in. The default is 5 minutes.

Fix touch to behave consistently

The touch option recently added to increment! in Active Record was not updating update_at/on attributes when passed attribute names. The behavior has now been fixed.

Fix result of transform_values in AC::Parameters

This method (and transform_values!) was not consistently returning an instance of ActionController::Parameters. This PR (from a first-time contributor!) fixes it.

18 people contributed to Rails this past week, including 2 first-time contributors. Check out the list of open issues!

Among other news, a security vulnerability was disclosed this week so update Sprockets to the latest version if you haven’t yet.

Oh, and my talk about Active Storage at RailsConf 2018 is finally on YouTube. 🤗 Have a great weekend!

Faster record deletion, customized error messages, bug fixes, and more!

Greetings, all! This is Daniel, with the latest news about Ruby on Rails.

This Week’s Contributors

14 people contributed to Rails this past week, including 4 first-time contributors. Many thanks to all!

Are you looking to get involved? Check out the list of open issues!

Faster dependent destroying

Has GDPR got you deleting users and all their “likes”? The dependent: destroy option has been updated to use a linear algorithm, rather than a quadratic one. I like that!

Allow suffixing store attributes

Back in March we added the option to use prefixes for your store attributes. Well now you can use suffixes as well. Say goodbye to clashing method names!

Flexible error message customization

Ever find yourself wanting to override the default Active Model error message format for a particular model or attribute, rather than for the whole language? Well now you can!

Eager loading in development

In Rails 5.1 and 5.2 setting config.eager_load = true in development could cause the server to lock up. As I’m sure you could guess, we were eager to get this merged.

Fix round trip problem with params

Parsing nested params is not easy, but your controller tests may depend on it. Luckily we were able to handle it with Rack and a little bit of tender love.

But wait, there’s more! If you are eager for more Ruby on Rails news, check out the full list of commits from the past week. Otherwise, see you next week!