Miscellaneous
dataSource()
Signature
Section titled “Signature”dataSource() — returns any
Description
Section titled “Description”Use this method to override the data source connection information for this model.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
datasource | string | yes | — | The data source name to connect to. |
username | string | yes | — | The username for the data source. |
password | string | yes | — | The password for the data source. |
Examples
Section titled “Examples”dataSource(datasource [, username, password ]) <!--- In models/User.cfc --->
<cffunction name="init">
<!--- Tell Wheels to use the data source named `users_source` instead of the default one whenever this model makes SQL calls --->
<cfset dataSource("users_source")>
</cffunction>