# File lib/active_record/relation/delegation.rb, line 10 def self.delegate_to_scoped_klass(method) if method.to_s =~ /\A[a-zA-Z_]\w*[!?]?\z/ module_eval def #{method}(*args, &block) scoping { @klass.#{method}(*args, &block) } end, __FILE__, __LINE__ + 1 else module_eval def #{method}(*args, &block) scoping { @klass.send(#{method.inspect}, *args, &block) } end, __FILE__, __LINE__ + 1 end end
# File lib/active_record/relation/delegation.rb, line 26 def respond_to?(method, include_private = false) super || Array.method_defined?(method) || @klass.respond_to?(method, include_private) || arel.respond_to?(method, include_private) end
# File lib/active_record/relation/delegation.rb, line 34 def method_missing(method, *args, &block) if @klass.respond_to?(method) ::ActiveRecord::Delegation.delegate_to_scoped_klass(method) scoping { @klass.send(method, *args, &block) } elsif Array.method_defined?(method) ::ActiveRecord::Delegation.delegate method, :to => :to_a to_a.send(method, *args, &block) elsif arel.respond_to?(method) ::ActiveRecord::Delegation.delegate method, :to => :arel arel.send(method, *args, &block) else super end end
Generated with the Darkfish Rdoc Generator 2.