Ruby on Rails - 模型上的 make 方法是什么? [英] Ruby on Rails - what is make method on a model?
本文介绍了Ruby on Rails - 模型上的 make 方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 lib/tasks/data.rake 中,我有 User.make(attributes).make 方法似乎创建了一个新记录,但我找不到任何关于此的文档.make 方法不是由我的 User 模型定义的,而且我的 User 模型继承了 ActiveRecord::Base.
In my lib/tasks/data.rake, I have User.make(attributes). The make method appears to create a new record, but I cannot find any docs on this. The make method is not defined by my User model and fyi my User model inherits ActiveRecord::Base.
推荐答案
我'打电话给朋友',原来是 https://github.com/notahat/machinist gem
I 'called a friend', it turned out to be https://github.com/notahat/machinist gem
这篇关于Ruby on Rails - 模型上的 make 方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文