I want to rename the timestamp columns defined in timestamp.rb . Can the methods of timestamp.rb be overwritten? And what has to be done in the application that the module w
An updated anwser for Rails >= 5.1. I would suggest to use the ApplicationRecord
that is available by default in your application and define the following:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
class << self
private
def timestamp_attributes_for_create
super << 'my_created_at_column'
end
def timestamp_attributes_for_update
super << 'my_updated_at_column'
end
end
end
Note that you can also use this block on a specific model if you don't want to configure it for all your models.
Note also that you should use strings and not symbols.