Last active
December 9, 2015 20:31
-
-
Save BideoWego/576cf1f0168f7346b8be to your computer and use it in GitHub Desktop.
A Ruby on Rails model concern that allows a model to reference the database adapter type via a simple getter, great for database driver specific functionality!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AdapterAcknowledgeable | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def adapter | |
self.connection.instance_values["config"][:adapter] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment