Flowdock
method

method_missing

Importance_0
v3.2.8 - Show latest stable - 0 notes - Class: CollectionProxy
method_missing(method, *args, &block) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/collection_proxy.rb, line 77
      def method_missing(method, *args, &block)
        match = DynamicFinderMatch.match(method)
        if match && match.instantiator?
          send(:find_or_instantiator_by_attributes, match, match.attribute_names, *args) do |r|
            proxy_association.send :set_owner_attributes, r
            proxy_association.send :add_to_target, r
            yield(r) if block_given?
          end

        elsif target.respond_to?(method) || (!proxy_association.klass.respond_to?(method) && Class.respond_to?(method))
          if load_target
            if target.respond_to?(method)
              target.send(method, *args, &block)
            else
              begin
                super
              rescue NoMethodError => e
                raise e, e.message.sub(/ for #<.*$/, " via proxy for #{target}")
              end
            end
          end

        else
          scoped.readonly(nil).send(method, *args, &block)
        end
      end
Register or log in to add new notes.