Monday, November 2, 2020

Multiple database improvements, bugfixes and more!

Posted by gregmolnar

Hey, this is Greg bringing you the latest news about the Rails framework.

Show outstanding migrations on the error page

This PR adds the details of the pending migrations to the pending migrations error message so you will know from the error what’s pending.

Add ability to set per param encoding

Previously you could skip encoding which would encode all parameters on an action as ASCII_8BIT, but after this change you can specify the param_encoding for any one parameter on an action in your controller. An example can be found here.

Fix resources being fetched twice when crossorigin attribute is used

When you load a script or css (by using javascript_include_tag or stylesheet_link_tag respectively) with crossorigin attribute applied, Rails currently causes some browsers to fetch these resources twice. That is because crossorigin in the link header preload directive and on the resource itself need to match in order for browsers to re-use a resource.
This PR changes it so that the link header directives include the same crossorigin values as those that have been passed to the resources themselves, which allows browsers to reuse the preloaded resource.

Implement connecting_to method

Sometimes you need to have a different default connection but aren’t calling the connection with a block. An example is booting a console in reading mode. This PR adds the ability for a script to set a specific connection on boot while preserving the behaviour of connected_to for application code.

Warn if we can’t read the yaml to create database tasks

For multiple databases Rails attempts to generate the tasks by reading the
database.yml before the Rails application is booted but there are some complex cases when this is not possible and Rails will simply issue a warning saying it couldn’t infer the database tasks from the database.yml.

Fix TimeWithzone bug

There was a rounding off issue when we were comparing TimeWithZone times with DateTime and this PR fixes that.

29 people contributed to Rails since last week. Check out the detailed list of all changes. Until next week!