views:

36

answers:

1

have a legacy table with a field "LastModifiedDate", and I want to use that column as my "updated_at" column.

Is there any way to tell Rails to use that field?

Or, let me rephrase. :) ... How can I tell Rails to use that field? :)

Thanks!

A: 

Hi You may use after_update to change value of that column

Bohdan Pohorilets
Would this allow Rails to use this column magically? Or with this method, will I need to set the value explicitly myself.
Mr M
Other than setting it for you, `updated_at` doesn't really do any magic for you. You could add an `updated_at` method to your model that returns the `LastModifiedDate` as a `Time` and get the effect you want.
Squeegy
If I also added an "updated_at=" method, would Rails do its setting magic as well?
Mr M