Change the #to_key and #to_param methods to call the according methods of the model.