Sunday, September 30, 2018

Multi env credentials support, Action Cable channel unit testing and more!

Posted by _cha1tanya

Hello everyone! This is Prathamesh from Pune, India bringing you the latest news from the Rails world.

Multi environment support for credentials

Now it is possible to have credentials for each environment. If the file for current environment exists it will take precedence over config/credentials.yml.enc. For eg. production environment looks for
config/credentials/production.yml.enc first.

Support for unit testing Action Cable channels

This change introduced ActionCable::Channel::TestCase  which provides an ability to unit test channel classes.

Raise error when using recyclable cache keys using a store which does not support it

Some cache stores do not support recyclable cache keys. This can lead to generating the cache entries which never invalidate.

This change adds a check to ensure that if recyclable cache keys are being used then the cache store needs to show that it supports this versioning scheme. 

Improvements to migration paths of multiple databases

This change adds an option to specify the migrations paths while generating the models.

bin/rails g model Room capacity:integer –migrations-paths=db/kingston_migrate

Additionally, a shortcut database option is added which uses the database configuration for the current environment.

Eagerly define attribute methods in production

The attribute methods for a model are currently defined lazily the first time that model is instantiated, even when config.eager_load is true.

Now they are defined while the app is booted to save the database round trip costs. There is related discussion and a pull request to do this change only when schema cache exists.

Ignore psqlrc files when executing psql commands within Rails

.psqlrc files can affect the execution of commands that can hold up execution by blocking or cause side effects.

Rails ignores it now by using -X option.

It is also ignored while loading structure.sql file for PostgreSQL databases by Rails.

Add a way to check for subset of arguments when performing jobs

The arguments need to match exactly what the job get passed when calling assert_performed_with / assert_enqueued_with

This change makes it possible to only check if a subset of arguments were passed to the job. Handy when you have too many arguments for the job.

50 people contributed to Rails over the past two weeks. Check out the full list of changes. If you are interested in helping out, we have plenty of open issues. I hope to see your name on the list next week!