I have timestamps in virtually all of my tables. The timestamp I want
to add is always the current time, whenever I create a record in a
table. Is this the type of thing I can be setting in my models,
without have to be worrying about it in my controller methods. And if
so, how would i do that in the model?
Any help you can provide would be appreciated! Thanks!
I have timestamps in virtually all of my tables. The timestamp I want
to add is always the current time, whenever I create a record in a
table. Is this the type of thing I can be setting in my models,
without have to be worrying about it in my controller methods. And if
so, how would i do that in the model?
Any help you can provide would be appreciated! Thanks!
If you have a field in your database table named updated_at that is
:datetime, rails will automatically do it for you and you don’t need to
do
anything else anywhere. Similarly for created_at
I’m sure there’s a way in your model to tell Rails to use a different
column than updated_at, but search for updated_at for more details.