Saturday, November 21, 2015

This week in Rails: RailsConf 2016, frozen Hash keys, faster byebug and more!

Posted by chancancode

Hi everyone! This is Godfrey bringing you the latest news from Rails.

RailsConf 2016

The RailsConf 2016 website is up! This year, we will be gathering in Kansas City from May 4 to May 6. If you would like to submit a talk, the call for proposals (CFP) is open from now until Jan 15!

This Week’s Rails Contributors

This week we have seen commits from 29 different contributors in the Rails repository, including 6 new faces!

Improved

Frozen FK Names For Association

When you use a non-frozen (i.e. mutable) string as a Hash key, Ruby would have to duplicate and freeze it in order to guarantee a stable hash key.

This is usually fine, but when that string is used to build many different hashes, the work adds up. Fortunately, we can simply freeze it upfront to avoid the repeated work.

Faster byebug

byebug 7.0 has recently been released with some major performance improvements. (See this pull request for details.) If you are using byebug for debugging, you might want to upgrade!

Speeding Up Enumerable#sum

Did you know that Enumerable#{inject,reduce} can take a symbol as its argument? Apparently, this is slightly faster too! (Note: this is different from inject(&:method) which goes through Symbol#to_proc.)

Fixed

Use Instead Of +…+ In Docs

Usually, you can use +some_word+ to switch to fixed-width fonts in Rails’ documentation. However, the parser for this rule would sometime fail in some more complex cases.

If you are not sure when to use which, be sure to check the guidelines, or just check the output locally by running rake rdoc.

Wrapping Up

That’s all for This week in Rails. As always, there are many more changes than we have room to cover here, but feel free to check them out yourself.

Until next time!