ActiveRecord\AbstractRelationship::create_association PHP Method

create_association() public method

Creates a new instance of {@link Model} and invokes save.
public create_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model
$model activerecord\Model The model which holds this association
$attributes array Hash containing attributes to initialize the model with
return activerecord\Model
    public function create_association(Model $model, $attributes = array(), $guard_attributes = true)
    {
        $class_name = $this->class_name;
        $new_record = $class_name::create($attributes, true, $guard_attributes);
        return $this->append_record_to_associate($model, $new_record);
    }