Rails 6.0.0 rc2 released

The final version of Rails 6.0 is almost ready, but before we put a pin in it, please enjoy this second release candidate. We’ve cleared all the blockers that were discovered during the first release candidate, and if nothing new and major is discovered, we’ll ship the final release in a couple of weeks.

There has been 172 commits of changes since rc1.

You can read all about what’s new in Rails 6.0.0 in the first beta announcement. From Action Mailbox to Action Text, multiple database support, parallel testing, and Webpacker handling JavaScript by default. This is a massive step forward for Rails.

This release, and all releases leading up to Rails 6.0 final, was shepherded by release manager Rafael França with support by Kasper Timm Hansen.

Active Storage, startless range in queries, SMS links and more!

Hello! This is Roque bringing the latest news from the Rails community. It’s been awhile so let’s see what has changed since then… Oops, since last week 😜

Preserve existing attachment assignment behavior for app upgraded to Rails 6.0

Assigning a collection of attachments appends to the collection as it did in 5.2. Existing 5.2 apps that rely on this behavior will no longer break when they’re upgraded to 6.0. For Apps generated on 6.0, assigning replaces the existing attachments in the collection. #attach should be used to add new attachments to the collection without removing existing ones.

Support startless ranges in queries

Add support to startless ranges (e.g. ..10 and ..Date.today), introduced by Ruby 2.7.0-preview1, to Active Record queries. This enables expression like Order.where(created_at: ..1.year.ago).

When the users click the SMS link, their messaging app opens with the phone number and optional message body set in the link.

Superclass for aborted queries

The class ActiveRecord::QueryAborted makes it possible, for example, to rescue all possible query timeouts without rescuing other query exceptions.

Add --skip-collision-check option to the Rails generator

This allows the generator for 6.0 to behave like it used to in 5.2, and overwrite files.

18 people contributed to Rails in the last week. Want to see your name on that list? Check out the list of issues here.

Until next time!

New contributors fixing bugs in the summer

Hey all! This is Daniel from Brooklyn, NY bringing you the latest news in Rails.

Add database_exists? method to connection adapters

The database_exists? method does what you might think—it checks whether a database exists. This will help in resolving some inconsistencies between SQLite and the other database adapters.

Share column and table names between connections

Sharing is a beautiful thing. Since connection instances are likely to share table and column names, we can store them on the class instead of on each instance. Isn’t that nice?

Fix query cache when using shared connections

Congratulations to Heinrich on their first commit to Rails!

Fix bug when combining order with exist?

Congratulations to Takayuki on their first commit to Rails!

21 people contributed to Rails in the last week. Want to see your name on that list? Check out the list of issues here.

Be well!

Schema dump fix and database task creation improvements!

Hi there. This is Greg bringing you latest news from the Rails world. We had a quiet week, so I won’t take long.

Fix schema dumping for enum and set columns in MySQL

With this change Active Record will use the sql_type rather than type, in the database dump for enum and set columns to make sure they use the correct type.

Warn if database tasks can’t be created

With this change, Rails loads the initial database.yml once, and warns if it can’t create tasks. This is important for multiple databases, where the tasks are created for every database, but to create those Rails needs to read the list from database.yml.

9 people contributed to Rails in the last week, if you want to be one of them, check out the list of issues here.

Until next time!

☀️🏖🏄‍♀️ and schema cache deduplication plus getutc begone

Ahoy all! 🚢 Step aboard as we cruise through the Rails news this week. Summer has really hit its simmering point for many a Rails contributor: we’re seeing fewer contributions. Take heed! Your trusty captain Kasper is here to reassure you that nothing has gone wrong on this ship and that it’s merely summer time seasoning. But also, the engine is on fire? Oh well, it’ll probably burn out soon enough and another wrong has been righted! This is fine. 🔥

Schema Cache: deduplicate structures

This week has primarily been a strong one for Active Record’s schema cache with no less than 3 improvements. It’s a little known feature but it avoids querying your database for its schema every time a new server starts up (handy if you’re booting up many app servers). You invoke it with…

Schema Cache: stop serializing and parsing columns_hash

rails schema:cache:dump, check its documentation for more. These 3 changes are around deduplication the memory that the schema cache holds in a running app by doing deduplication. Basically running a uniq on objects and reusing already initialized ones. This technique is uncommon, but effective here, because so many tables share the same columns, e.g. id, created_at, updated_at etc. So the first change…

Schema Cache: deduplicate when using init_with

…ran deduplication for most things in the schema cache. The second change skipped storing the columns_hash in the YML, because it could be derived with columns.index_by(&:name). Thus saving storing every column object again, but just nested under the name. Neat! Rounding out the features: the deduplication should also be run when parsing YML and the parser invoking init_with. Remedied that, phew! I suggest you do check all three changes out because they show to really re-sculpt a feature over multiple PRs.

Active Record: avoid redundant time.getutc when serializing

Lastly, rounding out the news: some more speed ups! Currently serializing a Time attribute will run time.getutc in multiple places regardless of whether the time is already UTC, which is fairly expensive. This change checks if the time is already UTC and won’t bother with any needless conversion. ⏱

21 people contributed to Rails in the last two weeks. You can see the full list of changes here.

Until next time!

Direct upload mirroring, multiple databases overview and more

Hi there. This is Wojtek bringing you goodies from the Rails world.

Document multiple databases

Gives a great overview of available multiple database features coming in Rails 6.

Mirror direct uploads

Tells the mirror service to copy the blob from the primary service to any secondary service where it doesn’t already exist.

Fix preloading on ActiveRecord::Relation

Fixes a case where records are duplicated by a join by using a less known Hash method compare_by_identity.

Improve on_rotation in MessageEncryptor

Allow on_rotation option in MessageEncryptor to be passed in constructor.

Make rescues layout responsive

Debugging on small devices got a lot easier by adjusting default errors layout. Check the pull request for sample image.

51 people contributed to Rails in the last month. You can see the full list of changes here.

Until next time!

Performance improvements, large file uploads to S3 and more!

Hello fellow Rubyist!

This is Greg, bringing the latest news about the Rails framework!

Fill a Trix editor easily in system tests

ActionDispatch::SystemTestCase#fill_in_rich_text_area  can  locate and fill a Trix editor with the given HTML in your system tests.

ActiveRecord#respond_to? performance improvements

The changes introduced by this pull request made ActiveRecord#respond_to?  1.5x faster and it also no longer allocates strings.

Permit uploading files larger than 5 GB to S3

If you are using S3 with Active Storage, now you can upload large files and the services will transparently switch to streaming.

HashWithIndifferentAccess#initialize performance improvement

With this change, a quite expensive to_hash call is bypassed in the constructor if we are already dealing with a hash.

Expose mailbox_for method in ApplicationMailbox

Rails 6 is bringing Action Mailbox and with this change, it will be possible to check which mailbox an email is routed to without processing it.

40 people contributed to Rails in the last week. If you want to be part of that, check out the list of open issues.

Until next time!

Rails 6.0.0.rc1 is here, say hi at RailsConf!

Hop aboard fellow traveler! Here’s your friendly conductor Kasper revving up to give you a brand spanking new issue for the price of zilch.

We’re just about to roll into RailsConf proper. Several of your trusty editors are going including me, Eugene, Tim, and Vipul! Many people who are Rails committers and core will be there too. Feel free to say hi if you spot us — we don’t byte a bit 😄

Rails 6.0.0.rc1 is out!

Rails 6 is almost out the door. The first release candidate came out this week. This is the best time to get bug fixes in because we on the Rails core team will prioritize bugs found in rc1 and then ship an rc2 shortly. If no bugs are found after roughly 2-3 weeks, the real 6.0.0 is cut.

Model errors as objects

Now that 6.0.0.rc1 is out Rails 6.1 development has started too. And the first feature has already landed! Active Model validations has long had errors that were plain hashes, but in 6.1 they’ll be objects!

Check Zeitwerk compatibility

Rails 6’s new autoloader Zeitwerk got a new command to check if your app is compatible. Simply run bin/rails zeitwerk:check and it’ll print out potential problems.

Reuse retry logic for old jobs

One of the benefits of GitHub being on the latest Rails was seen this week as they could test 6.0. GitHub found a potential regression in Active Job rectified it. The fix is Le Git!

10% faster Active Record attribute access

Due to some nifty code rearrangement accessing attributes of an Active Record model became 10% faster albeit with a slight maintenance cost. An additional 20% speed boost on id was also squeezed in.

34 people contributed to Rails in the last week. You can see the full list of changes here.

Until next time!

Rails 6.0.0 rc1 released

Okay, so we didn’t quite make our aspirational release schedule, but Rails 6 is now almost ready, so here’s the first release candidate! There isn’t anything remarkably new compared to the beta releases, but everything has been polished (in about 1000 commits!), and we believe this candidate could become the final release, lest we find any egregious bugs.

This may well also be the best exercised release candidate in the history of Rails! The team at Basecamp, Shopify, and GitHub are all running either rc1 or just-about in production. It’s been a real pleasure to see the Shopify and GitHub teams leap to the front of the line running the latest in production.

If it’s good enough for Basecamp, Shopify, and GitHub, it’s probably good enough for you too! (But please do test, file bugs, and help us certify that it actually is).

If you’re starting a new application today, you should definitely be starting it on 6.0.0.rc1. And if you’re running an existing application under active development, you should probably also upgrade. Doing so will help us flush out the last issues before the final release.

You can read all about what’s new in Rails 6.0.0 in the first beta announcement. From Action Mailbox to Action Text, multiple database support, parallel testing, and Webpacker handling JavaScript by default. This is a massive step forward for Rails.

Also, kudos to Sam Ruby, David Bryant Copeland, and the crew at The Pragmatic Programmers for having a beta of Agile Web Development with Rails 6 ready to coincide with rc1.

Finally, we can’t wait to see everyone at a sold-out RailsConf in Minneapolis next week. It’s never been a better time to be programming with Rails.

This release, and all releases leading up to Rails 6.0 final, was shepherded by release manager Rafael França with support by Kasper Timm Hansen.

Performance improvements, collection cache versioning and more

Hello. This is Wojtek reporting on recent changes from Rails world.

Collection cache versioning

Add cache_version on relation to support recyclable cache keys via the versioned entries in ActiveSupport::Cache. This also means that cache_key will now return a stable key that does not include the max timestamp or count any more.

Speed up dirty tracking

Reports 2x ~ 30x faster execution time compared to original implementation.

Add dirty methods for store accessors

It is now possible to use methods defined by Dirty module on store accessors.

Add after_save_commit callback shortcut

Adds shortcut for very common case:

after_commit :hook, on: [ :create, :update ]

Notes tags registration

It is now possible to register custom tags that will be included on bin/rails notes command.

Add db:prepare rake task

Based on state of database it runs setup or migrate tasks.

Add detach_from to ActiveSupport::Subscriber

It is now possible to opt-out from listening on chosen events.

Factorize bin/update in bin/setup

Replaced two files with one. From now on bin/setup should be idempotent in the project, thus should run fine on the first time setup and after any update.

71 people contributed to Rails in the last 3 weeks. You can see the full list of changes here.

Until next time!