Friday, October 28, 2022

More intuitive checking of form check boxes and radio buttons

Posted by morgoth85

Hi, Wojtek here with this week’s news from the Rails world.

Support checked as a keyword argument in check_box_tag and radio_button_tag
Now the form helper

f.check_box "admin", checked: false

works as expected. Previously it had to be passed as positional argument.

Allow Active Record adapter “execute” to retry on connection-related exception

Setting allow_retry to true causes the database to reconnect and retry executing the SQL statement in case of a connection-related exception. Should only be used for known idempotent queries.

Expose the “request.parameter_filter”
Feature is useful when one wants to filter some hashes based on the same parameter filter as the request:

request.parameter_filter.filter("secret" => "foo", "something" => "bar"))
#=> { "secret" => "[FILTERED]", "something" => "bar" }

Adds “validate” to foreign keys and check constraints in database schema file
Previously, schema.rb would not record if validate: false had been used when adding a foreign key or check
constraint, so restoring a database from the schema could result in foreign keys or check constraints being
incorrectly validated.

Fix “MemoryStore” to preserve entries TTL when incrementing or decrementing
The change is to be consistent with how MemCachedStore and RedisCacheStore behaves, ie don’t remove the expiration value.

There were 23 contributors to Rails this week. You can browse all the changes here.
Until next time.

Subscribe to get these updates mailed to you.