Module: Bigamy

Defined in:
lib/bigamy.rb,
lib/bigamy/ar.rb,
lib/bigamy/mongo.rb,
lib/bigamy/proxy.rb

Defined Under Namespace

Modules: ActiveRecord, Base, Mongo Classes: ARBelongsTo, ARHasMany, ARHasOne, BelongsTo, HasMany, HasOne, MongoBelongsTo, MongoHasMany, MongoHasOne, NewRecordAssignment, Proxy

Class Method Summary collapse

Class Method Details

.setup(*args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bigamy.rb', line 12

def self.setup *args
  args.each do |klass|
    case
    when klass.ancestors.include?(::ActiveRecord::Base)
      Bigamy::ActiveRecord.configure klass
    when (klass.included_modules & [::MongoMapper::Document, ::MongoMapper::EmbeddedDocument]).present?
      klass.plugin Bigamy::Mongo
    else
      raise "NO #{klass}"
    end
  end
end