Cheers everyone, the new Rails 5.2.0 has released. Let’s have a look at the new features and upgrades in it.
It’s been too hard to deal with file uploads in Rails. There’s been a lot of fine plugins available, but it was overdue that we incorporated something right into the framework. Finally, we have one, in the form of Active Storage. This release includes Active Storage, a new framework provided by Rails to make it easier to upload and process files. With this new framework, we’ve solved for the modern approach of uploading files straight to the cloud. Out of the box, there’s support for Amazon’s S3, Google’s Cloud Storage, and Microsoft Azure Cloud File Storage. If you’re dealing with images, you can create variants on the fly. If you’re dealing with videos or PDFs, you can create previews on the fly. And regardless of the type, you can analyze uploads for metadata extraction asynchronously. This framework is not only used in production, but it is born for production.
There’s a sparkling new Redis Cache Storage that incorporates general partial, fragment, and other Rails caching jobs into a cohesive unit that anyone can use.This new Redis Cache Store supports Redis::Distributed, for Memcached-like sharding across Redises. It’s fault tolerant, so will treat failures like misses, rather than kill the request with an exception. It even supports distributed MGETs for that full partial collection caching goodness.
Rails 5.2.0 has Added support for PostgreSQL operator classes to
The operator classes identify database operators to be used by the index for the columns. You can assign the same operator to all columns, or not. It currently only supports PostgreSQL.
Added ability to create PostgreSQL foreign keys without validation. Normally, PostgreSQL verifies that all rows in a table satisfy its foreign keys constraints. With this option, you can create these constraints without the overhead of checking if they are valid.
On the topic of performance, Rails now ships with Bootsnap in the default
Gemfile. This generally reduces application boot times by over 50%.
CSRF and XSS have enhanced that further in Rails 5.2 with the addition of a new DSL that allows you to configure a Content Security Policy for your application. We can configure a global default policy and then override it on a per-resource basis and even use lambdas to inject per-request values into the header such as account subdomains in a multi-tenant application.
In Rails 5.2, we’ve rectified the mess by deprecating the two different kinds of secrets and introduced a new shared concept called Credentials. Credentials, like AWS access keys and other forms of logins and passwords, were the dominant use case for secrets. Credentials are always encrypted. This means they’re safe to check into revision control, as long as you keep the key out of it. This means atomic deploys and there is no need to mess with environment variables.
Thanks again to everyone who continue to pour their love and support into Ruby on Rails! Happy Coding.]]>