Parent Child Relationship

class Event < ActiveRecord::Base
has_many :categories
end

If I delete a category, it affects the events that were created
before. How can make sure that event can still display it’s old
category name? TIA.

Look at acts_as_paranoid. I use it for a similar, but different reason,
but it may help you. Basically, if you add acts_as_paranoid to your
category model, when you destroy a category, it actually sets a column
deleted_at to the current time. Acts_as_paranoid overrides the find and
count methods to ignore anything that has deleted_at not null. However,
it has accessor methods that allow you to return all categories
including those with the deleted_at column set. I heard someone say that
the author of this plugin may not be supporting it in the future,
however, I am using it with no issues. YMMV

http://wiki.rubyonrails.org/rails/pages/Acts+As+Paranoid+Plugin