Sunday, March 12, 2017

This Week in Rails: looots of fixes after the release and more.

Posted by vipulnsward

Hello!

This is Vipul reporting from Delhi today, on this colourful Holi weekend 💥
 
Lets take a look at what’s the latest news from the world of Ruby on Rails !
So many fixes and much more.

Google Summer of Code 2017

We’re very happy to announce that Ruby on Rails has been accepted as an organization for the Google Summer of Code (GSoC) 2017 edition!

Fixed

Make sure local cache is cleared even if it’s throwing error

When an error was thrown from the middleware chain, it was sometimes not getting caught by LocalCache::Middleware.

This change, makes sure that we safely catch the errors and local cache is successfully cleared.

Fix rake db:schema:load with subdirectories

Previously db:schema:load didn’t work with migrations based out of subdirectories.

This change starts using Migrator.migration_files in assume_migrated_upto_version to fix the issue.

Fix malformed asset_url in ActionController::Renderer

This change fixes an issue with malformed asset_url when rendering a template with ActionController::Renderer.

Fix select with block doesn’t return newly built records in has_many association

The select method in QueryMethods is also an enumerable method. Ideally, enumerable methods with block should delegate to records on CollectionProxy and not the scope.

This change fixes this behaviour that select with block doesn’t return newly built records in has_many association.

Update titlelize regex to allow apostrophes

In a previous fix the regex in titlelize was updated to not match apostrophes to better reflect the nature of the transformation.

Unfortunately this had the side effect of breaking capitalization on the first word of a sub-string, eg:

>> "This was 'fake news'".titleize
=> "This Was 'fake News'"

This change fixes this behaviour by extending the look-behind to check for word character apart from an apostrophe.

Fix deserialize with JSON array

JSON array data was being returned in a stringified form, due to broken deserialization.

This change fixes deserialization behaviour.

Deprecated

Deprecate Migrator.schema_migrations_table_name

SchemaMigration model was extracted and SchemaMigration.table_name was being used instead in places where Migrator.schema_migrations_table_name was being used previously.

Migrator.schema_migrations_table_name is now deprecated in favour of SchemaMigration.table_name.

Improved

Added reverse_merge/reverse_merge! to AC::Parameters

This change adds the reverse_merge and reverse_merge! methods to ActionController::Parameters, similar to their corresponding Hash methods.

Do not take screenshot if driver does not support screenshot

Capybara::RackTest::Driver does not support taking screenshots. If we call #save_screenshot on Capybara::RackTest::Driver , it will raise an error.

To prevent errors, if a driver in Systems test does not support screenshot, we do not call it after this change.

There were many other great pull requests this week from 20 contributors, including 4 first-timers. Thank you all!

Outside of code changes, we had many more good news this and the previous week.

Until next week!