On Queries and Orphans

The Problem

Let’s say you have a Group class like the one below:

The Solution

We can nullify group_id‘s value in a Railsy way by adding the following to our Group class:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Josias Alvarado

Josias Alvarado

Software Engineer | Technology Enthusiast