The Pragmatic Studio

No Tricks, Just Treats! 4 New Videos Added to Rails 6 Course

October 31, 2019

Many-to-many associations as well as custom scopes and routes were never meant to trick you. But if they do, this week’s four new Rails 6 videos will turn them from tricks into tasty treats! 🎃 🍫

Many-to-many associations are so common that we design a 5th and 6th example to continue building your confidence with these types of relationships. We also explore how to write idiomatic and concise custom scopes and routes to help users find exactly what they’re looking for.

In Module #38 we design yet another many-to-many relationship. This time we use a through association in the models and a collection of checkboxes in the user interface to assign multiple categories to events and multiple genres to movies.

One approach to defining a custom query is to write a class-level method. But a more idiomatic and concise way to write a custom query is in a declarative style using the scope method. Doing so in Module #39 lets us slice and dice our events and movies into all sorts of interesting categories.

With our scopes in place for specific criteria, it’s time to show them off. We set up custom routes so that users can easily filter what they’re looking for.

🎃 Enjoy, and Happy Halloween!