You can use the bake.php script for generate scaffolded Models, Views, and
Controllers. This generates actual code so you don't have to set the
$scaffold variable.
You can then remove the select box from the view code and edit the
controller to set the customer_id there.
Cheers,
Sonic
--~--~
See, because there's a potential for selecting the wrong "customer" on the
student form, that dropdown should really contain only one customer. Or that
dropdown shouldn't be shown at all. Or the scaffolding should be taken down.
Is there a way to get rid of the other customers in the dropdown witho
If you just select the customer you want and save it the student will only
be associated to that customer.
If you want that customer to be already selected prior to going to the add
student page, set the student id in the URL or session and edit the
CustomersController::add() action to get the id f
Your table structure should be something like:
students (id, name),
awards_ students (student_id, award_id)
awards (id, name, award_type_id),
award_types (id, award_name)
Your model associations should then be:
Student hasAndBelongsToMany Award,
Award hasOne AwardType
Set the reverse assocations