ActiveRecord\HasMany::inject_foreign_key_for_new_association PHP Method

inject_foreign_key_for_new_association() private method

private inject_foreign_key_for_new_association ( activerecord\Model $model, &$attributes )
$model activerecord\Model
    private function inject_foreign_key_for_new_association(Model $model, &$attributes)
    {
        $primary_key = $this->get_foreign_key_for_new_association($model);
        if (!isset($attributes[key($primary_key)])) {
            $attributes[key($primary_key)] = current($primary_key);
        }
        return $attributes;
    }