I am trying to use Rails3 with an existing db schema. The timestamp fields updated_at and created_at need to be mapped to created and modified on the db.
Is there a way to tell activerecord to use alternate column names?
Thanks in advance, Chris
EDIT
Could it be done by having this in a file in the model directory:
module ActiveRecord
module Timestamp
def timestamp_attributes_for_update #:nodoc:
[:modified, :updated_on]
end
def timestamp_attributes_for_create #:nodoc:
[:created, :created_on]
end
end
end
I don’t think there is a way to do that without overriding
timestamp_attributes_for_updatein ActiveRecord:: Timestamp.A simple workaround would be to use a
before_updatecallback in the model.