mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Make a snapshot name synced with the inventory name if changed [SCI-4656]
This commit is contained in:
parent
bc70ceb120
commit
388f52a064
1 changed files with 8 additions and 0 deletions
|
@ -15,6 +15,8 @@ class Repository < RepositoryBase
|
||||||
foreign_key: :parent_id,
|
foreign_key: :parent_id,
|
||||||
inverse_of: :original_repository
|
inverse_of: :original_repository
|
||||||
|
|
||||||
|
before_save :sync_name_with_snapshots, if: :name_changed?
|
||||||
|
|
||||||
validates :name,
|
validates :name,
|
||||||
presence: true,
|
presence: true,
|
||||||
uniqueness: { scope: :team_id, case_sensitive: false },
|
uniqueness: { scope: :team_id, case_sensitive: false },
|
||||||
|
@ -204,4 +206,10 @@ class Repository < RepositoryBase
|
||||||
RepositorySnapshotProvisioningJob.perform_later(repository_snapshot)
|
RepositorySnapshotProvisioningJob.perform_later(repository_snapshot)
|
||||||
repository_snapshot
|
repository_snapshot
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def sync_name_with_snapshots
|
||||||
|
repository_snapshots.update(name: name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue