add more safety

This commit is contained in:
Sam 2018-03-16 11:19:06 +11:00
parent d3943b97df
commit 5474635361

View File

@ -156,7 +156,7 @@ class RemoteTheme < ActiveRecord::Base
def update_theme_color_schemes(theme, schemes)
missing_scheme_names = Hash[*theme.color_schemes.pluck(:name, :id).flatten]
schemes.each do |name, colors|
schemes&.each do |name, colors|
missing_scheme_names.delete(name)
existing = theme.color_schemes.find_by(name: name)
if existing