Flowdock
method

load_target

Importance_0
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActiveRecord::Associations::AssociationCollection

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.0.9) is shown here.

These similar methods exist in v4.0.2:

load_target() protected

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/association_collection.rb, line 393
        def load_target
          if !@owner.new_record? || foreign_key_present
            begin
              if !loaded?
                if @target.is_a?(Array) && @target.any?
                  @target = find_target.map do |f|
                    i = @target.index(f)
                    if i
                      @target.delete_at(i).tap do |t|
                        keys = ["id"] + t.changes.keys + (f.attribute_names - t.attribute_names)
                        t.attributes = f.attributes.except(*keys)
                      end
                    else
                      f
                    end
                  end + @target
                else
                  @target = find_target
                end
              end
            rescue ActiveRecord::RecordNotFound
              reset
            end
          end

          loaded if target
          target
        end
Register or log in to add new notes.