Class: MongoMapper::Plugins::Associations::Collection

Inherits:
Proxy
  • Object
show all
Defined in:
lib/mongo_mapper/plugins/associations/collection.rb

Instance Attribute Summary

Attributes inherited from Proxy

#association, #proxy_owner, #target

Instance Method Summary collapse

Methods inherited from Proxy

#as_json, #blank?, #initialize, #inspect, #loaded, #loaded?, #nil?, #present?, #proxy_respond_to?, #reload, #replace, #respond_to?, #send, #to_json

Constructor Details

This class inherits a constructor from MongoMapper::Plugins::Associations::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MongoMapper::Plugins::Associations::Proxy

Instance Method Details

#include?(*args) ⇒ Boolean

Returns:



15
16
17
18
# File 'lib/mongo_mapper/plugins/associations/collection.rb', line 15

def include?(*args)
  load_target
  target.include?(*args)
end

#resetObject



20
21
22
23
# File 'lib/mongo_mapper/plugins/associations/collection.rb', line 20

def reset
  super
  target = []
end

#to_aryObject



6
7
8
9
10
11
12
13
# File 'lib/mongo_mapper/plugins/associations/collection.rb', line 6

def to_ary
  load_target
  if target.is_a?(Array)
    target.to_ary
  else
    Array(target)
  end
end