Build association silently deletes

At my last company customers sometimes complained that their profile had been deleted. It took me forever to figure out it was because they’d gone back in the signup flow and calling build again first deletes.

I totally assumed this was a serious Rails bug and opened an issue:

But apparently it’s not a bug. It’s certainly a WTF though and it has bitten other people (see issue comments). I’d like to discuss whether the name should be changed, or a warning spat out, or a bold note in the documentation.


Thanks for bringing this up! It seems like a weird behavior to me too… I wonder what the reason for it might be?

I like your ideas for at least warning that this is a “sharp knife” feature, even if we don’t wind up changing the method’s behavior.

It would probably make more sense if it deleted the existing record on save rather than on build (though that wouldn’t fix OP’s issue).

But apparently it’s not a bug.

The fact that the Rails bot automatically closed the issue as “stale” doesn’t necessarily mean that the maintainers didn’t consider this to be a serious bug. It just means that the issue wasn’t being commented on.

Personally, I’m strongly against legit issues being closed just because nobody has commented on them for 3+ months. As a maintainer I would just mark an issue with help-needed if I didn’t have time to tend to it. Closing issues is sacred for me, it should only be done if the issue is solved.

1 Like