thedrummeraki/tanoshimu

View on GitHub
app/models/upload.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
class Upload < ApplicationRecord
  belongs_to :user
  has_one_attached :attachment

  validates :upload_filename, presence: true

  def initialize(*args)
    super
    self.uuid = SecureRandom.uuid
  end

  def upload_filename
    "upload-#{upload_type}-#{uuid}"
  end
end