In my rails application,there are two models:post and catalog.
One post has a catalog,and one catalog has many posts.
When I delete a catalog,the posts belongs to the catalog will not be
shown normal,for it's catalog is no existed.
Now I want to create(if the 'Defalut catalog' is not existed) a
'Defalut catalog' in catalogs table,and make the posts's catalog belongs
to it,before I delete a catalog.
I just know there is 'before_destory' in ActiveRecord.But I don't know
how to do it.
Thanks for any replies.