非 ActiveRecord 模型的机械师
是否可以使用 Machinist 为非 activerecord 模型创建蓝图?无论我尝试什么似乎都会产生错误!
如果这对 Machinist 来说是不可能的,是否有其他夹具生成宝石可以做到这一点?我还读到工厂女孩对此有疑问。
Is it possible to use Machinist to create blueprints for non-activerecord models? Seems to generate an error no matter what I try!
If this is impossible with Machinist, is there another fixture generating gem that can do it? I've also read that Factory Girl has issues with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 Machinist 2 beta 1 做了一些调查,看起来它支持普通的 ruby 对象。这就是我为让它发挥作用所做的事情。很高兴了解任何更简单的解决方案。
I did a little bit of investigating into Machinist 2 beta 1 and it looks like it supports plain ruby objects. Here's what I did to get it working. Happy to learn of any simpler solutions.
如果有人好奇的话,FactoryGirl 和 PORO 的问题之一(可能还有其他问题)是它不处理带参数的构造函数。您可以根据此处的答案进行支付。
In case anyone's curious, one of the problems (there may be others) with FactoryGirl and POROs is that it doesn't handle constructors with arguments. You can make due per the answer here.