Registry is a well-known object that other objects can use to find common objects and services. Working with Rails, most objects can be navigated to using associations or as parameters of a method. However, there are certain situations where finding a required object is harder to get.

A Registry acts like global object.

The best example that comes to mind is running jobs in my GIDIG app. A Job belongs to a ClientIntegration; a ClientIntegration belongs to an Integration. An Integration has many IntegrationDocuments, which in turn, has many RowDefinitions, which in turn, has many RowFieldMaps. Using a Registry pattern may makes some sense in this case.

The data for a Registry vary based on the execution context such as globally across the entire process, thread, or session. You can have different registeries for different types of scope.

Use a Registry as a last resort.