Explain Rails Active Record Query

You can output the raw query for an Active Record Query by tagging .explain at the end. Very useful for complex queries where it’s hard to understand what is happening under the hood 🤯. You can read the docs for more info.