adminsが複数のユーザーをグループに追加できるアプリケーションを構築しています。 UserControllerのAddアクションでは、次のようになります。form-> select( 'group_id')は、Cakephpのグループではなくidだけを表示します。
$this->set('groups', $this->User->Group->find('list'));
出力は、現在グループテーブルにある別のグループの選択ボックスにする必要があります。
Groups table:
'id' 'group' 'comments'
Model (user):
public $belongsTo = array('Group');
UserController:
$this->set('groups', $this->User->Group->find('list'));
View (Users/add)
echo $this->Form->input('Group_id');
私は間違っていますか?
どのケーキのバージョンを使用していますか? –
2.1現在、それは新しいビルドです。 –
あなたはそれを正しく行うようです。 http://book.cakephp.org/2.0/ja/core-libraries/helpers/form.html –