Make - notahat/machinist GitHub Wiki
Once you’ve defined a blueprint for a class, you use the make method to construct objects of that class.
Post.make # Returns a new Posts.You can override attributes defined in the blueprint by passing them in to make.
Post.make(:title => "Custom Title")Machinist won’t construct objects for attributes you override:
Comment.blueprint do
post { Post.make }
end
Comment.make(:post => nil) # This won't make a post.You can make an array of several objects by passing a count to make.
Post.make(3) # Returns an array of 3 posts.If you’re making an ActiveRecord object, and you want it to be saved to the database, call make!.
Post.make! # Makes and saves a post.make! will intelligently cache objects. Read more about Object Caching.