As a web application framework, Ruby on Rails has existed for over 15 years and is used by companies such as Airbnb, Groupon, and Shopify, who also play a key role in improving Rails. As an established web tool we can expect that the latest versions of Rails may not bring revolutionary changes but they do bring about improvements in efficiency, which is a key component of the Ruby on Rails brand.
Upgrading your systems is not always a straightforward decision, especially if your application could stop working as a result of deprecations of features or compatibility issues with other software. Careful planning is needed to calculate the time and cost of upgrades, but let’s take a look at the five things you need to know about the latest version of Ruby on Rails, version 6:
It is important to provide a secure environment for customers and users of your web application. Rails provides regular security patches for the last few major releases so keep an eye out for these and upgrade as soon as possible. For example, release, 188.8.131.52, addressed vulnerabilities that could allow users to be redirected to malicious websites.
2. New features
Developers of Ruby on Rails are consistently looking to improve functionality and efficiency for users of their product so you will need to upgrade to fully experience everything Rails can offer.
- Multiple Databases – One notable feature of Rails 6 was adding support to create multiple databases for your models and the ability to switch between them. Release 6.1.0 adds further support with per-database connection switching (previously when you switched the role, the role would also change for all database connections) and horizontal sharding (multiple partitions for the same database schema).
- Parallel testing – introduced in Rails 6, parallel testing is a welcome addition for anyone who has experienced working with a slow-running test suite. You can now specify the number of workers and each worker will be assigned a test database to run tests simultaneously.
- Active Mailbox – another Rails 6 addition, Active Mailbox functions as an email inbox for your application and will provide support for all your incoming mail.
- Destroy Associations Async – as part of the Rails 6.1.0 release this adds support for destroying objects in bulk. Asynchronous actions can help reduce timeouts and queuing issues which may be an important cog of your e-commerce application.
3. Improvements and bug fixing
New releases are not all about adding new features, and they often apply fixes and improvements that go unheralded but are a vital part of your application running smoothly and speedily. For example, destroying records with destory_all now is done in batches by default, which means your database isn’t locked while cleaning up data.
4. Dependency compatibility
As your web application grows you will undoubtedly include other third party software libraries (gems) that add new features or customisations to your application. Typically authors of these gems stop supporting older versions of Ruby on Rails to focus on the latest released version.
You will likely reach a point in time where you need to upgrade your gems, either for security or to add additional functionality, but it isn’t supported by an older version of Rails. By updating your Rails application regularly it becomes easier to also update the gems you use within your application.
5. Speed and Efficiency
As users and developers, we all want our web applications to load and run quickly. Ruby is the computing language Ruby on Rails is written in, and when version 3.0 was released in December 2020 the key statement was that it will run 3 times faster than Ruby 2.0. Similarly, speed is a major focus of the ongoing support of Ruby on Rails, with asynchronous functionality to avoid jobs being held in a queue, parallel testing, bulk database entries such as insert_all and upsert_all, and other speed improvements for database queries.