Machinist 1.0: How to generate an object without saving it to the database

CAUTION It’s specific machinist 1.0-maintenance.

Machinist is an alternative for Fixtures or FactoryGirl.

make_unsaved

If you want to generate an object without saving it to the database, replace make with make_unsaved

reference

So remember to use make_unsaved.

More

If you’re interested, here is the source code.

Under latest version

Well if you’re using latest machinist, which is 2.0 at this point, it’s much simpler and cleaner.

make for generating but not saving an object, make! for saving it to database.

Qihuan Piao

Qihuan Piao

Originally from China and now living in Tokyo, I started this blog to practice English. Over the years, writing helped me find my own voice and explore thoughts about identity, life, and ordinary things that catch my curiosity. I mostly write for myself, but I love it when something here connects with someone else.

Meanwhile, what I wrote in Japanese

Fruit Ninjia in Real Life and Flying Kittens

December 28, 2012

Meanwhile, what I wrote in Chinese

小悲伤之便当盒篇

December 18, 2012