Class Index [+]

Quicksearch

Sequel::Plugins::AssociationProxies::AssociationProxy

A proxy for the association. Calling an array method will load the associated objects and call the method on the associated object array. Calling any other method will call that method on the association’s dataset.

Constants

ARRAY

Empty array used to check if an array responds to the given method.

Public Class Methods

new(instance, reflection, reload=nil) click to toggle source

Set the association reflection to use, and whether the association should be reloaded if an array method is called.

    # File lib/sequel/plugins/association_proxies.rb, line 26
26:         def initialize(instance, reflection, reload=nil)
27:           @instance = instance
28:           @reflection = reflection
29:           @reload = reload
30:         end

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source

Call the method given on the array of associated objects if the method is an array method, otherwise call the method on the association’s dataset.

    # File lib/sequel/plugins/association_proxies.rb, line 34
34:         def method_missing(meth, *args, &block)
35:           (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)).
36:             send(meth, *args, &block)
37:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.