Gateway is an object that encapsulates access to an external system or resouce. It’s a very simple wrapper pattern. A Gateway is a good object to switch out the primary resource to service stub for testing purposes.
Rails ActiveRecord acts as a Gateway to various databases (MySQL, PostgreSQL, SQLite, SQL Server, Sybase, and Oracle.) Using ActiveRecord makes it easy to switch out database without impacting any of your code.