Skip to content

Model Configuration

table()

table() — returns void

Available in: model Category: Miscellaneous Functions

Use this method to tell Wheels what database table to connect to for this model. You only need to use this method when your table naming does not follow the standard Wheels convention of a singular object name mapping to a plural table name. To not use a table for your model at all, call table(false).

NameTypeRequiredDefaultDescription
nameanyyes—Name of the table to map this model to.
// 1. Map the `User` model to a non-standard table name.
// In models/User.cfc
function config() {
	// Tell Wheels to use `tbl_USERS` instead of the default `users` table.
	table("tbl_USERS");
}

// 2. Map a model to a table with a legacy prefix.
// In models/Product.cfc
function config() {
	table("legacy_products");
}

// 3. Declare a model that has no backing database table at all.
// In models/ApiResponse.cfc
function config() {
	table(false);
}