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
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:
$ a = Factory.create :article
=> #<Article _id: 4dc27b867319e80fb2000001, created_at: 2011-05-05 10:27:18 UTC,
updated_at: 2011-05-05 10:27:18 UTC, title: "Article 1", content: "This is a content
for Article 1.", visible: true, published_at: 2011-02-11 23:00:00 UTC, tags: ["ruby",
"rails", "sinatra"]>
$ a.title
=> "Article 1"
Just add something like this when starting in development mode:
require 'factory_girl'
# require factories
Dir["#{PATH_TO_FACTORIES}/*.rb"].each { |f| require f }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With