class MongoModel::Associations::Base::Proxy
Attributes
association[R]
Public Class Methods
new(association)
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 12 def initialize(association) @association = association end
Public Instance Methods
loaded!()
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 31 def loaded! @loaded = true end
loaded?()
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 27 def loaded? @loaded end
reset()
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 35 def reset @loaded = false @target = nil end
respond_to?(*args)
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 40 def respond_to?(*args) proxy_respond_to?(*args) || target.respond_to?(*args) end
Also aliased as: proxy_respond_to?
target()
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 22 def target load_target @target end
target=(new_target)
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 16 def target=(new_target) @target = new_target loaded! @target end
Private Instance Methods
load_target()
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 49 def load_target @target = association.find_target unless loaded? loaded! rescue MongoModel::DocumentNotFound reset end
method_missing(*args, &block)
click to toggle source
# File lib/mongomodel/concerns/associations/base/proxy.rb, line 45 def method_missing(*args, &block) target.send(*args, &block) end