Class: Packages::PackageFile

Inherits:
ApplicationRecord show all
Includes:
UpdateProjectStatistics
Defined in:
app/models/packages/package_file.rb

Instance Method Summary collapse

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#download_pathObject


50
51
52
# File 'app/models/packages/package_file.rb', line 50

def download_path
  Gitlab::Routing.url_helpers.download_project_package_file_path(project, self)
end

#local?Boolean

Returns:

  • (Boolean)

54
55
56
# File 'app/models/packages/package_file.rb', line 54

def local?
  file_store == ::Packages::PackageFileUploader::Store::LOCAL
end

#update_file_metadataObject


44
45
46
47
48
# File 'app/models/packages/package_file.rb', line 44

def 
  # The file.object_store is set during `uploader.store!`
  # which happens after object is inserted/updated
  self.update_column(:file_store, file.object_store)
end