Module: Mongo::Voteable::Integrations::Mongoid::ClassMethods

Defined in:
lib/voteable_mongo/integrations/mongoid.rb

Instance Method Summary collapse

Instance Method Details

#voteable_collectionObject



20
21
22
# File 'lib/voteable_mongo/integrations/mongoid.rb', line 20

def voteable_collection
  collection
end

#voteable_foreign_key(metadata) ⇒ Object



24
25
26
# File 'lib/voteable_mongo/integrations/mongoid.rb', line 24

def voteable_foreign_key()
  .foreign_key.to_s
end

#voteable_relation(class_name) ⇒ Object



16
17
18
# File 'lib/voteable_mongo/integrations/mongoid.rb', line 16

def voteable_relation(class_name)
  relations.find{ |x, r| r.class_name == class_name }.try(:last)
end