Skip to content

Instantly share code, notes, and snippets.

@BideoWego
Last active December 9, 2015 20:31
Show Gist options
  • Save BideoWego/576cf1f0168f7346b8be to your computer and use it in GitHub Desktop.
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!
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