如何在工厂女孩中安装调试器?
如何调试factory_girl?我试图将调试器放在那里,但我就是不能。我只是想测试为什么我的关联无法正常工作
How do you debug factory_girl? i've tried to put debugger in there but i just cant. I just want to test why my associations aren't working right
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是如何使用调试器的?如果您尝试在测试环境中使用它,我对它不起作用并不感到惊讶。但factory_girl并不局限于测试环境。
只需在开发环境中需要factory_girl gem 和相关工厂,使用调试器(或只是控制台)启动服务器,然后就可以进行调试了。
更新
我在https://github.com/lstejskal/icanhazblog。当您安装它并运行“rails console”时,您可以执行以下操作:
在开发模式下启动时只需添加类似的内容:
How did you use the debugger? If you tried to use it in test environment, I'm not surprised it didn't work. But factory_girl is not limited to test environment.
Simply require factory_girl gem and relevant factories in development environment, start the server with debugger (or just console) and you're set for debugging.
UPDATE
I have this setup in https://github.com/lstejskal/icanhazblog. When you install it and run 'rails console', you can then do stuff like:
Just add something like this when starting in development mode: