Want more GoRails?

GoRails is packed full with 719 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Refactoring with Enumerable partition

June 10, 2024

Track your progress

Sign in to track your progress and access subscription-only lessons.

Log In

Your Teacher

Collin Jilbert

Ruby on Rails Developer | Lover of Music | Skateboarder | Proud Papa | Co-editor @therubyradar | Launched @fleur_de_ruby

About This Episode

In this lesson, we will look at how to clean up code that iterates over a collection twice to separate the elements out to only doing so once while achieving the same result by leveraging the partition method from Ruby's Enumerable module.

Want to stay up-to-date with Ruby on Rails?

Join 86,796+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.