Skip to content

Instantly share code, notes, and snippets.

@yaychris
Last active December 20, 2015 15:49
Show Gist options
  • Save yaychris/6156829 to your computer and use it in GitHub Desktop.
Save yaychris/6156829 to your computer and use it in GitHub Desktop.
module SimplestAuth
module Model
def self.included(base)
adapters.each do |adapter|
if adapter.registered?(base)
include adapter
end
end
end
def self.adapters
Adapters.constants.map { |c| SimplestAuth::Model::Adapters.const_get(c) }
end
module Adapters
module ActiveRecord
def registered?(base)
# code to determine if ActiveRecord is being used
end
end
module DataMapper
def registered?(base)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment