Saturday, February 14, 2015

This week in Rails: Speedy Integration Tests, Enum Queries and more!

Posted by kaspth

Dearest darling, reindeer-eyed reader

Hither summoned is Kasper, Duke of Friendly Ghosts, to bring forth thy worthy commits and Pull Requests of Rails as subscribed.

Thusly commences our journey on this Friday the 13th - Ok, I’m sick of writing like that.

This Week’s Contributors

A round of applause goes to this weeks contributors from all of us at this virtual news desk. We editors did a full on spit take when realizing a whopping 28 people contributed. Nothing seals that memory quite like the scalding coffee on our thighs.

Integration Tests Only 12% Slower than Controller Tests

You may have thought Speed was just a movie. But we’re feeling it this week as our world got rocked with a refactoring bringing integrations’ speed closer to functionals. Stay at the edge of your seats for the sequel.

Improved

Make enums queryable by label

After an amazing refactoring job on Active Record internals that took many months, this change was easy. Enums can now be queried by their labels. Post.where(status: Post.statuses[:draft]) is out in favor of Post.where(status: :draft).

fresh_when and stale? accepts a collection

They say that stale? is everyone’s best friend. It will be by you until you get to fresh_when. Even if you need help when a collection seems impassable. Look around, you dingus, your best friends are adaptable.

There’s usage examples on the Pull Request.

find_in_batches got an end_at option

Sometimes you gotta know when the fun oughta stop. Sadly find_in_batches and find_each would keep going like the party animals they are. Or were, as both matured this week with a new end_at option. But they’re still keeping it plenty rad in their parents basement if anybody asks.

One More Thing™

Kasper Timm Hansen is an issues team member

Kasper first impressed us when he shipped his 2013 Rails GSoC project in 2014. In his spare time he writes a newsletter called This Week in Rails. In fact he wrote this very issue. Aw shucks, I thought there was something familiar about me and I!

Wrapping up

This was a weird one, right? Hopefully of the glorious kind.

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

P.S. If you enjoyed this newsletter, why not share it with your friends? :) If you wish to be part of this project please don’t hesitate to contact Godfrey – there’re a lot of ways you could help make this newsletter more awesome!