Module: ActiveRecord::Delegation

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

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods, ClassSpecificRelation, DelegateCache

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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


117
118
119
120
121
122
123
124
125
# File 'activerecord/lib/active_record/relation/delegation.rb', line 117

def method_missing(method, *args, &block)
  if @klass.respond_to?(method)
    scoping { @klass.public_send(method, *args, &block) }
  elsif arel.respond_to?(method)
    arel.public_send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)

110
111
112
113
# File 'activerecord/lib/active_record/relation/delegation.rb', line 110

def respond_to?(method, include_private = false)
  super || @klass.respond_to?(method, include_private) ||
    arel.respond_to?(method, include_private)
end