The `RecordsUploads::Concern` concern will create an `Upload` entry for every file stored by a `GitlabUploader` persisting the dynamic parts of the path using
`GitlabUploader#dynamic_path`. You may then use the `Upload#build_uploader` method to manipulate the file.
## Object Storage
By including the `ObjectStorage::Concern` in the `GitlabUploader` derived class, you may enable the object storage for this uploader. To enable the object storage
in your uploader, you need to either 1) include `RecordsUpload::Concern` and prepend `ObjectStorage::Extension::RecordsUploads` or 2) mount the uploader and create a new field named `<mount>_store`.
The `CarrierWave::Uploader#store_dir` is overriden to
-`GitlabUploader.base_dir` + `GitlabUploader.dynamic_segment` when the store is LOCAL
-`GitlabUploader.dynamic_segment` when the store is REMOTE (the bucket name is used to namespace)
### Using `ObjectStorage::Extension::RecordsUploads`
> Note: this concern will automatically include `RecordsUploads::Concern` if not already included.
The `ObjectStorage::Concern` uploader will search for the matching `Upload` to select the correct object store. The `Upload` is mapped using `#store_dirs + identifier` for each store (LOCAL/REMOTE).
```ruby
classSongUploader<GitlabUploader
includeRecordsUploads::Concern
includeObjectStorage::Concern
prependObjectStorage::Extension::RecordsUploads
...
end
classThing<ActiveRecord::Base
mount:theme,SongUploader# we have a great theme song!
...
end
```
### Using a mounted uploader
The `ObjectStorage::Concern` will query the `model.<mount>_store` attribute to select the correct object store.
This column must be present in the model schema.
```ruby
classSongUploader<GitlabUploader
includeObjectStorage::Concern
...
end
classThing<ActiveRecord::Base
attr_reader:theme_store# this is an ActiveRecord attribute
mount:theme,SongUploader# we have a great theme song!