I have two Models:
Company
belongs_to :company_type
CompanyType
set_table_name “company_type”
has_many :companies, :dependent => :nullify
The company table has fields: id, company_type_id, etc…
The company_type table has fields: id, ctype
When I delete a CompanyType, the nullify dependency sets the
company_type_id to 0 in the Company table, which results in a nil object
error in /company/list
Can anyone suggest a workaround for this? I am thinking of adding a
rescue in the list method which asks the user to reassign the ctype if
it is null, but am wondering if there’s a better way?