Namespacing Might Be an Architecture
Explore how namespacing in Rails routing creates a clear separation of resources used in different contexts. Understand creating namespaces to organize controllers and views, maintain clean URL helpers, and avoid overly complex controller logic. This lesson helps you manage routes effectively and recognize when architectural changes might be necessary to keep your app maintainable.
We'll cover the following...
What is namespacing?
Namespacing in the context of routes is a technique to disambiguate resources that have the same name but are used in completely different contexts. Perhaps our app needs a customer service interface to view, update, and delete widgets, the same resources accessed by users—but requires a totally different UI. While we could complicate WidgetsController and its views to check to see if the user is a customer service agent, it’s often cleaner to create two controllers and two sets of ...