Let's say I have two models that both have same callbacks:
class Entry < ActiveRecord::Base
belongs_to :patient
validates :text, presence: true
after_validation :normalizeDate
def normalizeDate
self.created_at = return_DateTime(self.created_at)
end
end
class Post < ActiveRecord::Base
after_validation :normalizeDate
def normalizeDate
self.created_at = return_DateTime(self.created_at)
end
end
Where can I put the shared callback code? Thanks
def normalizeDate
self.created_at = return_DateTime(self.created_at)
end