I have a simple “Log” model, that records the fact of calling controller’s action.
Entries of this “log” record are supposed to be created once and never altered. Also, I will have many of these records in the database.
So, there is no need for “updated_at” column (don’t need to waste the memory on HDD).
How can I tell to Rails to leave only “created_at” column and not to use “updated_at”?
Is there any way to make the “Log” model read only?
You can make the model readonly by adding a
readonly?method to the model.The example above was adopted from here.
If you don’t need the
updated_atcolumn, just remove (or don’t add it) it from your database. Rails won’t update what’s not there.