The differences between .build, .create, and .create! and when should they be used?

后端 未结 4 2013
遇见更好的自我
遇见更好的自我 2020-12-07 06:47

So I\'ve been seeing people using .build, .create, and .create! within their controllers more and more lately. What\'s the difference

4条回答
  •  星月不相逢
    2020-12-07 07:41

    I'd second the above answers. Plus for create, one cannot pass false as an argument which you can do with save. Passing false as an argument will skip all rails validations

提交回复
热议问题