Module: Mongoid::Lookup::ClassMethods

Defined in:
lib/mongoid_lookup.rb

Instance Method Summary collapse

Instance Method Details

#has_lookup(name, options, &block) ⇒ Object

Configures lookup on calling model. accepts a block which will be evaluated in the class of the generated lookup reference model



21
22
23
24
# File 'lib/mongoid_lookup.rb', line 21

def has_lookup name, options, █
  include Model unless included_modules.include?(Model)
  build_lookup(name, options, &block)
end

#lookup_collectionObject

Configures calling model as a lookup collection



13
14
15
16
# File 'lib/mongoid_lookup.rb', line 13

def lookup_collection
  include Collection
  build_lookup_collection
end