This Week in Rails

September 30, 2022

ERB in YAML keys, performance boosts, a new option for QueryLogs!

こんにちは。I'm Emmanuel, and I've got some updates for you!

Avoid double type cast when serialising attributes
ActiveModel::Attribute#value already casts model attributes when persisting models, however some model attribute types try to cast a given value before serialising it. This means casting is done twice in most cases. This PR fixes that, giving us some performance boost.

Add ability to set the tags_format for QueryLogs
ActiveRecord::QueryLogs gets a new tags_format option. This makes it possible to specify if we want to use the default :legacy formatter or :sqlcommenter.

Facilitate use of any regular ERB in database.yml
DummyCompiler has been replaced with ERB::Compiler. True to what dummy compilers do, it'd blow up when one tried to use ERB in a YAML key. This PR makes it possible to use ERB in YAML keys. While at it, we also deprecated config.active_record.suppress_multiple_database_warning.

Rails.error.report now marks errors as reported
Rails.error.report now marks errors as reported to avoid reporting them twice. This PR also enables catching and reporting errors outside of the execution context.

We saw 23 contributors in the last seven days.

That's it. Until next week!