Return to v1.4.5 docs

findOrCreateBy[Property]()



Returns the object or creates a new one if it wasn't found.

Name Type Required Default Description
save boolean No true Passing in false will create the object without saving it to the database.
// Return the first object that matches "Timberlake" in the last name column. If there is no match, create a new one and set firstName to "Justin".
newArtist = model("artist").findOrCreateByLastName(lastName="Timberlake", firstName="Justin");