Skip to content
  • Ryuta Kamizono's avatar
    66ec4294
    Allow `build` multiple records even on non association relation · 66ec4294
    Ryuta Kamizono authored
    Follow up to #41342.
    
    The reason why the problem of #41342 occurred is that unlike `create`,
    `build` did not support the creation of multiple records, so it did not
    address the problem.
    
    It is weird that `post.commnets.where(foo: "bar").build([obj1, obj2])`
    is allowed but `Comment.where(foo: "bar").build([obj1, obj2])` is not
    allowed.
    
    To avoid the confusion, it allows `build` multiple records even on non
    association relation.
    66ec4294
    Allow `build` multiple records even on non association relation
    Ryuta Kamizono authored
    Follow up to #41342.
    
    The reason why the problem of #41342 occurred is that unlike `create`,
    `build` did not support the creation of multiple records, so it did not
    address the problem.
    
    It is weird that `post.commnets.where(foo: "bar").build([obj1, obj2])`
    is allowed but `Comment.where(foo: "bar").build([obj1, obj2])` is not
    allowed.
    
    To avoid the confusion, it allows `build` multiple records even on non
    association relation.
Loading