Re: [Hobo Users] Delete multiple items

20 views
Skip to first unread message

Matt Jones

unread,
Jul 19, 2012, 7:45:55 AM7/19/12
to hobo...@googlegroups.com

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

tomkins

unread,
Jul 19, 2012, 8:24:29 AM7/19/12
to hobo...@googlegroups.com
Thank you very much man, I have it working now.

T.
Reply all
Reply to author
Forward
0 new messages