Model Object Miscellaneous Functions string model
Returns the value of the primary key for the object.
If you have a single primary key named id, then
someObject.key() is functionally equivalent to
This method is more useful when you do dynamic programming and don't know the name of the primary key or when you use composite keys (in which case it's convenient to use this method to get a list of both key values returned).
// Get an object and then get the primary key value(s) employee = model("employee").findByKey(params.key); val = employee.key();