Method: Sequel::Plugins::AssociationProxies::AssociationProxy#method_missing

Defined in:
lib/sequel/plugins/association_proxies.rb

#method_missing(meth, *args, &block) ⇒ Object

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.



94
95
96
97
98
99
100
101
# File 'lib/sequel/plugins/association_proxies.rb', line 94

def method_missing(meth, *args, &block)
  v = if @instance.model.association_proxy_to_dataset.call(:method=>meth, :arguments=>args, :block=>block, :instance=>@instance, :reflection=>@reflection, :proxy_argument=>@proxy_argument, :proxy_block=>@proxy_block)
    @instance.public_send(@reflection[:dataset_method])
  else
    @instance.send(:load_associated_objects, @reflection, @proxy_argument, &@proxy_block)
  end
  v.public_send(meth, *args, &block)
end