sql icon indicating copy to clipboard operation
sql copied to clipboard

feat: query callbacks in model

Open qszhu opened this issue 6 years ago • 0 comments

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

qszhu avatar May 19 '19 15:05 qszhu