Displaying 1 result from an estimated 1 matches for "destroy_company".
2006 Jan 01
9
Child record becomes orphan
...9;'t be deleted when it still has contacts. (because I can now,
which results in nil like errors when listing the contacts ... obviously)
Are there any helpers to do so, is Rails aware of this? Or do I need to put in
a condition before destroying the company record in question myself?
def destroy_company
# Haven''t figured out the syntax yet so don''t laugh about the line below.
if Contact.find_all(params[:company_id]) == Company.find(params[:id]) <<<
flash[:notice] = ''This company has contacts.''
redirect_to :action => ''show_c...