Module: ActiveRecord::Delegation::ClassSpecificRelation

Extended by:
ActiveSupport::Concern
Defined in:
activerecord/lib/active_record/relation/delegation.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Method Summary

Methods included from ActiveSupport::Concern

append_features, extended, included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)


57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'activerecord/lib/active_record/relation/delegation.rb', line 57

def method_missing(method, *args, &block)
  if @klass.respond_to?(method)
    self.class.delegate_to_scoped_klass(method)
    scoping { @klass.send(method, *args, &block) }
  elsif Array.method_defined?(method)
    self.class.delegate method, :to => :to_a
    to_a.send(method, *args, &block)
  elsif arel.respond_to?(method)
    self.class.delegate method, :to => :arel
    arel.send(method, *args, &block)
  else
    super
  end
end