The before_validation callback allows restrictions to particular events within the lifecycle of an object.
You can use the following syntax:
before_validation :set_uuid, on: :create
before_validation :upload_to_system, on: [:create, :update]
Here is the documentation of this option for Rails 4.0, Rails 5.2, Rails 6.0 and Rails 7.0.