Ruby, Ruby, Ruby, Ruby! What’s New?

Ruby, Ruby, Ruby, Ruby! What’s New?

What is Ruby on Rails?

Despite the Kaiser Chiefs’ song claiming the simple requirements from Ruby, “There is nothing I need, except the function to breathe”, the demands of users has driven the continued development of the Ruby on Rails framework.  283 versions in the making and Ruby 5.0.0.rc1 was released as of the start of May. Already 30,000 apps have upgraded to this, although this is a rather small amount compared to the 67,709,164 downloads the software boasts. Either way it’s fair to say quite a number of developers are using the software. So what has changed in the software? And will the changes to the developers have any effect on you?

Well first off, some of you out there may not even have been aware of Ruby on Rails before now. This robust framework is used by many big companies, including household names such as Airbnb, Hulu (if you’re American) and if you’re a Purr customer you’ll be familiar with Zendesk (our ticketing system) who also use it as their framework of choice.

In the right hands Rails can be used to create some wonderful apps including Ship From UK, BTL Property, WorkRest and several other projects currently underway.

Ruby on Rails optimises for programmer happiness with Convention over Configuration. The Rails Doctrine best sums this up by saying…

“Where Python might boast that there’s “one and preferably only one way to do something”, Ruby relished expressiveness and subtlety. Where Java championed forcefully protecting programmers from themselves, Ruby included a hanging rope in the welcome kit. Where Smalltalk drilled a purity of message passaging, Ruby accumulated keywords and constructs with an almost gluttonous appetite.”

From a techy perspective, Ruby on Rails is a web application framework written in Ruby, Rails is framework that acts as a Model-View-Controller (MVC) on top of Ruby. This provides default structures for databases, web services and web pages.

What has changed in the new version of Ruby on Rails?

There are many new features of the new Rails. As a brief overview it:

  • Has_secure_token to generate unique random token
  • Changed Active Job default adapter from Inline to Async
  • Provides application config to use UUID as primary key
  • Changes protect_from_forgery execution order
  • Allows to send log to STDOUT via environment variable
  • Adds a warning when fetching big result set with Active Record
  • Added accessed_fields to find the fields that are actually being used in the application
  • Supports MariaDB
  • Adds a way to get information about types of failed validations
  • Allows updating a record without updating timestamps
  • Adds after_{create,update,delete}_commit callbacks aliases
  • Supports bi-directional destroy dependency
  • Accepts 1 or true for acceptance validation
  • Supports configuring Active Job backend adapter for each job
  • Extracted attributes assignment from Active Record to Active Model
  • Adds a hidden field on collection radio buttons
  • Adds ignored_columns for Active Record
  • Renamed transactional fixtures to transactional tests
  • Adds ArrayInquirer and provides friendlier way to check contents in an array

Jargon aside, are any of these features going to change anything? Well:

  • Has_secure_token to generate unique random token – is a much cleaner way of doing this.
  • Adds a warning when fetching big result set with Active Record – is a great safety feature, ensuring that you don’t overload the server.
  • Added accessed_fields to find the fields that are actually being used in the application – is a really handy way of finding unused term fields, accessing only the necessary attributes from the database.
  • Adds a way to get information about types of failed validations – our team personally use a huge amount of terms and so we can now give custom error messages in a more simple way.
  • Adds ArrayInquirer and provides friendlier way to check contents in an array – Top of the list, this change creates a much faster way of querying arrays; this is something that we do all the time!

There isn’t a ground breaking revelation buried in the code, but there is a large number of practical, sensible and useful tools that will make a Ruby on Rails developer’s life a little easier.

What to look forward to in the Future with Ruby 3?

Ruby 3 started development in 2014, there is version 2.4 yet to come before this, though there are a number of ideas suggested by its inventor Yukihiro Matsumoto. These include improved man machine collaboration, performance enhancements and concurrency. We will follow this and provide updates as further news filters through.

To summarise, get your Ruby on Rails software upgraded, there are a number of useful enhancements that you would be foolish to not be taking advantage of. And more important still, when working with Ruby on Rails and the developers who make the magic happen, remember …

Ruby on Rails Fun

Title image from Digital Ocean. Fun Gem from BlowMage.

Stephen Collins