Commit 813b58bb authored by Toon Claes's avatar Toon Claes

Method `model` on replicator should be on class

The method `model` on the replicator should be a class method. And
generally the class methods are defined before the instance methods.
parent 879d1679
...@@ -188,7 +188,7 @@ For example, to add support for files referenced by a `Widget` model with a ...@@ -188,7 +188,7 @@ For example, to add support for files referenced by a `Widget` model with a
1. Create `ee/app/replicators/geo/widget_replicator.rb`. Implement the 1. Create `ee/app/replicators/geo/widget_replicator.rb`. Implement the
`#carrierwave_uploader` method which should return a `CarrierWave::Uploader`. `#carrierwave_uploader` method which should return a `CarrierWave::Uploader`.
And implement the private `#model` method to return the `Widget` class. And implement the class method `.model` to return the `Widget` class.
```ruby ```ruby
# frozen_string_literal: true # frozen_string_literal: true
...@@ -197,14 +197,12 @@ For example, to add support for files referenced by a `Widget` model with a ...@@ -197,14 +197,12 @@ For example, to add support for files referenced by a `Widget` model with a
class WidgetReplicator < Gitlab::Geo::Replicator class WidgetReplicator < Gitlab::Geo::Replicator
include ::Geo::BlobReplicatorStrategy include ::Geo::BlobReplicatorStrategy
def carrierwave_uploader def self.model
model_record.file ::Widget
end end
private def carrierwave_uploader
model_record.file
def model
::Widget
end end
end end
end end
......
...@@ -4,12 +4,12 @@ module Geo ...@@ -4,12 +4,12 @@ module Geo
class PackageFileReplicator < Gitlab::Geo::Replicator class PackageFileReplicator < Gitlab::Geo::Replicator
include ::Geo::BlobReplicatorStrategy include ::Geo::BlobReplicatorStrategy
def carrierwave_uploader
model_record.file
end
def self.model def self.model
::Packages::PackageFile ::Packages::PackageFile
end end
def carrierwave_uploader
model_record.file
end
end end
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