-
Notifications
You must be signed in to change notification settings - Fork 134
Make
notahat edited this page Aug 23, 2010
·
10 revisions
Once you’ve defined a blueprint for a class, you use the make
method to construct objects of that class.
Post.make
You can override attributes defined in the blueprint by passing them in to make
.
Post.make(:title => "Custom Title")
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
Read more about [[Make!]]