Commit ffea496b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix PackageFile for object storage [ci skip]

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent cbe6403e
......@@ -7,4 +7,12 @@ class Packages::PackageFile < ActiveRecord::Base
validates :file_name, presence: true
mount_uploader :file, Packages::PackageFileUploader
after_save :update_file_store, if: :file_changed?
def update_file_store
# 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
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment