Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7f16af18
Commit
7f16af18
authored
Nov 16, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract RepositoryOnShard concern
parent
e7016722
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
app/models/concerns/repository_on_shard.rb
app/models/concerns/repository_on_shard.rb
+18
-0
app/models/pool_repository.rb
app/models/pool_repository.rb
+1
-10
spec/models/pool_repository_spec.rb
spec/models/pool_repository_spec.rb
+2
-0
No files found.
app/models/concerns/repository_on_shard.rb
0 → 100644
View file @
7f16af18
# frozen_string_literal: true
module
RepositoryOnShard
extend
ActiveSupport
::
Concern
included
do
belongs_to
:shard
validates
:shard
,
presence:
true
end
def
shard_name
shard
&
.
name
end
def
shard_name
=
(
name
)
self
.
shard
=
Shard
.
by_name
(
name
)
end
end
app/models/pool_repository.rb
View file @
7f16af18
# frozen_string_literal: true
# frozen_string_literal: true
class
PoolRepository
<
ActiveRecord
::
Base
class
PoolRepository
<
ActiveRecord
::
Base
belongs_to
:shard
include
RepositoryOnShard
validates
:shard
,
presence:
true
has_many
:member_projects
,
class_name:
'Project'
has_many
:member_projects
,
class_name:
'Project'
after_create
:correct_disk_path
after_create
:correct_disk_path
def
shard_name
shard
&
.
name
end
def
shard_name
=
(
name
)
self
.
shard
=
Shard
.
by_name
(
name
)
end
private
private
def
correct_disk_path
def
correct_disk_path
...
...
spec/models/pool_repository_spec.rb
View file @
7f16af18
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
describe
PoolRepository
do
describe
PoolRepository
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment