Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chulkilee/ee7543a2ede6001cded4d94b687f4384 to your computer and use it in GitHub Desktop.
Save chulkilee/ee7543a2ede6001cded4d94b687f4384 to your computer and use it in GitHub Desktop.
GitLab: backfill service from template
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