This spooky week in Rails: bidirectional destroys, indexed errors and horror!


Beware of those,

In forests reigned by cawing crows

Who feel the fright, a stormy friday night

Your weekly Rails news, pick and choose

As we weave, this;

All Hallow's Eve

Bet you didn't expect to get spooked the day beforeHalloween, well, that's our trick-a-trété. What? That's what the french say — don't ask.

Featured This Week's Rails Contributors

This week 42 contributors gathered in the town square, pitchforks in hand, and chased bugs out of Rails and up the mill.

That's what mob programming is all about. I assume.

Bidirectional Destroys

Say, a USAand a USSRmodel employed defensive measures to destroy the other if they we're destroyed. Before they'd keep destroying the other, now they're more peaceful only destroying each other once. Good thing it's a fictional example ��

Nested attributes indexes errors by insertions

Have models with accepts_nested_attributes_for? The macro nestled out an index_errorsoption, so errors attach to a specific model in the submitted array.

There's comments on the pull request, if you want to improve it further.

New Stuff Relation gets left_outer_joins

There's now an explicit way to do this specific join — abstracted away in includesbefore.

For those who want to be left out, er... join in!

Improved Many to many relationships count a little more

While calling counton a has_and_belongs_to_manyrelationship was correctly counted, amping up the inclusion made threw off the count. Now you can use includesand have things counted correctly again.

Sanitizing Order

You'd have to remember to sanitize arguments you passed to order, which, if you have an example like the one in the pull request, is a pain. No more.

HashWithIndifferentAccessdefaults with to_hashobjects

Passing an object that responds to to_hashto HashWithIndifferentAccess.newnow respects the default values and default proc if any of those are there.

One more thing™ Correction: Active Support delegation to block, argsor arg

Last week, we incorrectly said this change would raise exceptions. What really happens is delegatenow works with block, argsor argif those light your Jack-o'-lantern.

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!

Also if you really want to be scared, look yourself in the mirror! Boom, nailed it!