Created
April 25, 2018 19:34
-
-
Save chulkilee/ee7543a2ede6001cded4d94b687f4384 to your computer and use it in GitHub Desktop.
GitLab: backfill service from template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service_klass_to_property_keys = { | |
JiraService => %w[api_url url username password] | |
} | |
service_klass_to_property_keys.each do |klass, property_keys| | |
template_properties = klass.find_by!(template: true).properties.slice(*property_keys) | |
klass.find_each do |service| | |
service.properties = service.properties.merge(template_properties) | |
service.save! if service.changed? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment