sql
sql copied to clipboard
feat: query callbacks in model
Not sure whether this is the best way to do it. I added these so that I could write something like the following in a base model:
module Models::Base
# ...
def before_insert
@created_at = @updated_at = Time.utc
end
def before_update
@updated_at = Time.utc
end
end