class ActiveMongoid::Associations::Builders::In

Public Instance Methods

build(type = nil) click to toggle source
# File lib/active_mongoid/associations/builders/in.rb, line 6
def build(type = nil)
  return object unless query?
  return nil if object.blank?
  type = type.constantize if type and type.is_a?(String)
  model = type ? type : __metadata__.klass
  __metadata__.criteria(object, model).first
end