comanage-dev - [comanage-dev] Nifty Cake Feature
Subject: COmanage Developers List
List archive
- From: Benn Oshrin <>
- To: comanage-dev <>
- Subject: [comanage-dev] Nifty Cake Feature
- Date: Fri, 07 Dec 2012 17:18:06 -0500
You might already have know about this, but I just accidentally discovered it.
"Assuming that User hasAndBelongsToMany Group. In your controller, set a camelCase plural variable (group -> groups in this case, or ExtraFunkyModel -> extraFunkyModels) with the select options. In the controller action you would put the following:
$this->set('groups', $this->User->Group->find('list'));
And in the view a multiple select can be created with this simple code:
echo $this->Form->input('Group');
"
http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html
So basically input() will turn a field into a select if it sees a plural variable matching the field name.
-Benn-
- [comanage-dev] Nifty Cake Feature, Benn Oshrin, 12/07/2012
Archive powered by MHonArc 2.6.16.