1
<cfset  result = model("user").updateByKey(
                     key=authUser.user_id
                    , encryption_key=local.encryptionKey
                )>

The code above returns the following error in cfwheels:

The key argument contains an invalid value.

Suggested action

The key argument contains a list, however this table doesn't have a composite key. A list of values is allowed for the key argument, but this only applies in the case when the table contains a composite key.

Now I have resolved this by using the update all method like this:

<cfset recordsReturned = model("user").updateAll(
          encryption_key=local.encryptionKey
         , where="user_id=#authUser.user_id#"
     )>

I've checked the database and cannot find duplicate primary keys. I've also tried setting the instantiated=false argument in the updateByKey method but that did not work either. Any explanation as to why this might happen would be appreciated. ps: the closest thing i have to a primary key in the table apart from the user_id is the email_address which is unique so as not to allow duplicates.

0 Answers0