when I update data in the User model, the Auth data is not updated.
How can I \"refresh\" the data which is returned by $this->Auth->user() when I am updating user model
I solved this problem using afterSave function in User Model. It's working fine if we update user model from any area. My code was as below :
class User extends AppModel {
... ... ...
public function afterSave($created, $options = array()){
parent::afterSave($created,$options);
//updating authentication session
App::uses('CakeSession', 'Model/Datasource');
CakeSession::write('Auth',$this->findById(AuthComponent::user('id')));
return true;
}
... ... ...
}