Back

table()

Name Type Required Default Description
name any Yes Name of the table to map this model to.
1. Basic override for custom table name
// In app/models/User.cfc
function config() {
 // Tell Wheels to use the `tbl_USERS` table instead of the default `users`.
 table("tbl_USERS");
}

2. Using a table with a completely different name
// In app/models/Order.cfc
function config() {
 // Map the Order model to a table named `sales_transactions`.
 table("sales_transactions");
}

3. Disabling table mapping for a non-database model
// In app/models/Notification.cfc
function config() {
 // This model will not connect to any table.
 table(false);
}

4. Working with legacy naming conventions
// In app/models/Product.cfc
function config() {
 // The database uses uppercase with prefixes for tables.
 table("LEGACY_PRODUCTS_TABLE");
}
Copied!