On Jul 19, 2012, at 5:10 AM, tomkins wrote:

> Hi, 
> 
> I currently have a page with a table-plus of companies, each of which can 
> have many contacts. All contacts are listed on another page in another table.
> If I delete a company the contacts don't get deleted, they are left with null 
> value for their company attribute.
> They are connected in my sqlite3 database, each contact row has a column with 
> companyID.
> How can I delete all the contacts belonging to the company when I press 
> remove company?

You're looking for the :dependent option for has_many:

http://guides.rubyonrails.org/association_basics.html#has_many-dependent

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to