Bugfixes, improvements and more!

Hi, Greg here, bringing you the latest news about Ruby on Rails.

Make ‘rails tmp:clear’ clear ‘tmp/storage’

tmp/storage is the default root for the disk service used in test, and it is cleared by the tmp:clear command now.

Generators should raise an error if an attribute has an invalid type

Generators can create invalid migrations when passing an invalid attribute type. For example, when mixing up the name and type we can end up with a failing migration, but with this PR, that won’t be possible again and we will get an error if using an invalid type.

Allow to overwrite Cache-Control header in fresh_when and stale?

This PR adds a cache_control: {} option to fresh_when and stale?, to use it as a shortcut to set response.cache_control manually.

NumberToRoundedConverter should handle -Float::INFINITY

With this fix, the
NumberToRoundedConverter will correctly handle -Float::INFINITY and will return “-Inf” for it.

Faster check for any default scope with all_queries

The check for default scopes with all_queries became easier to read and also faster. There are benchmarks included in the PR if you are interested.

Remove Command::Spellchecker and use DidYouMean for suggestions

Instead of generating a custom “Maybe you meant…” message, when a generator or a command isn’t found, Rails will use DidYouMean in the future.

Add a commented root path declaration to routes.rb

If you ever found yourself looking up the syntax of setting a root path when starting a new Rails project, you will appreciate this small addition.

Strip final newline from Action View renderers

This PR introduces the strip_trailing_newlines option to ActionView::Base, which removes trailing newlines from rendered output. This means that partials can be rendered inline without introducing additional whitespace to the output, which affects how the browser may render it.

32 people contributed to Rails past week. Check out the open issues to get involved and help out. Until next week!

This Week in Rails · 30 N Racine #200 · Chicago IL 60607 · USA
Unsubscribe | View in browser