Deleting a Record

Hi.  I have a question about deleting a record.  I have a Project model and a ProjectMedia model.  Project HAS_MANY ProjectMedia.

I have r=project/show&id=1 set up to show all of the project information along with all of the associated media.

If I browse to r=projectMedia/admin… I get the original CRUD view of all projectMedia entries in the database.  If I click on "Delete" … it works just fine.

This is the code:

<?php echo CHtml::linkButton('remove',array(

&#039;submit&#039;=&gt;&#039;&#039;,


&#039;params&#039;=&gt;array(&#039;command&#039;=&gt;&#039;delete&#039;,&#039;id&#039;=&gt;$model-&gt;project_media_id),


&#039;confirm&#039;=&gt;&quot;Remove {$model-&gt;type-&gt;description}?&quot;)); ?&gt;

However… if I go to r=project/show&id=1… and then I try to click on Delete it's not working.  I tried changing the command to 'project_media/delete' but that's not working.

Can anyone give me a hand?  Much appreciated!

Sorry if this is a stupid question - it's probably really simple, so I was hoping someone could chime in.

Basically I want to delete a record from the view of another model… If I'm looking at a Project… I want to delete a row from the associated media table.

Do you try to delete media on project model BeforeDelete() function??