Daniel
Daniel

Reputation: 35724

cfwheels, getting errors from an unsuccessful model update

I'm trying to update a model with nested properties after an edit.

The update fails, but I'm not getting any errors using #errorMessagesFor(objectName='myobject')#.

Any idea how to get to the cause?

Upvotes: 1

Views: 542

Answers (2)

Chris Peters
Chris Peters

Reputation: 18090

I would use the allErrors() method on each of the objects in the array.

for (local.object in myObject.arrayOfObjects) {
    if (local.object.hasErrors()) {
        WriteDump(var=local.object.allErrors(), abort=true);
    }
}

Upvotes: 3

Mike Henke
Mike Henke

Reputation: 864

You may want to try the Wheels google group and include some code examples.

If after the error happens in the controller if you do a redirect, the model object with the error doesn't exist, you'll have to do a renderpager.

Upvotes: 1

Related Questions