I see in the rom-rails there is a way to do this, I am not on rails fortunately.
What would be the best way to have these fields and have them populated and the updated_at field populated on save? at the moment I am manually doing this in my models to_h method, and then using this to persist for example:
class User
…
def to_h
{
…
updated_at: Time.now,
created_at: @created_at || Time.now
}
end
end
Which is a bit clunky for me and I could not find any examples out there demonstrating a solution.