Module: ActiveRecord::Delegation

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

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods, ClassSpecificRelation, DelegateCache

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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


121
122
123
124
125
126
127
128
129
# File 'lib/active_record/relation/delegation.rb', line 121

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_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)

114
115
116
117
# File 'lib/active_record/relation/delegation.rb', line 114

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