From ca237f7a71169b2a56ada5145237098e4e854e2e Mon Sep 17 00:00:00 2001 From: Lucas Vieira Date: Tue, 26 Aug 2014 14:24:40 -0300 Subject: [PATCH] Fixed a bug when the type uses underscore. It was using the strtolower to set the type, but since it used the Inflector::camelize to set the relation, it need to use the Inflector::underscode to get the initial value. --- Model/Behavior/UploadBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Behavior/UploadBehavior.php b/Model/Behavior/UploadBehavior.php index 3f2c272..e637612 100644 --- a/Model/Behavior/UploadBehavior.php +++ b/Model/Behavior/UploadBehavior.php @@ -87,7 +87,7 @@ protected function _setRelationModel(Model $model, $type) { 'dependent' => true, 'conditions' => array( 'Attachment' . $type . '.model' => $model->alias, - 'Attachment' . $type . '.type' => strtolower($type)), + 'Attachment' . $type . '.type' => Inflector::underscore($type)), 'fields' => '', 'order' => '' );