Module: ActiveRecord::Collections::Delegation::ClassMethods

Defined in:
lib/active_record/collections/delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



9
10
11
12
13
# File 'lib/active_record/collections/delegation.rb', line 9

def method_missing(meth, *args)
  collection = new
  return collection.send(meth, *args) if collection.respond_to?(meth)
  super
end

Instance Method Details

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/active_record/collections/delegation.rb', line 15

def respond_to_missing?(meth, include_private=false)
  new.respond_to?(meth, include_private) || super
end