coldfusioncfwheels

Add a custom method in a Model using CFWHEELS


I am trying to add a custom method on one of my CFWheels Model but I am not able to do this. I have been reading the documentation but still not found an answer.

User.cfc

component extends="Component" {
    ...
    function getCustomSearch(){
        ...
    }
    ...
}

I want to change:

model("users").findAll(...)

To

model("users").getCustomSearch(...)

In order to refactor some function.

Is this possible? In that case, what I am doing wrong?

Thank you for your attention.

Regards.


Solution

  • It will need to be model('user') not users; Wheels looks for the singular variant to match the models/User.cfc file.