We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09c512b commit cb78a5eCopy full SHA for cb78a5e
app/models/setting.rb
@@ -74,7 +74,9 @@ def []=(key, value)
74
if value.nil?
75
where(var: dynamic_key).destroy_all
76
else
77
- super(dynamic_key, value)
+ # Use upsert for atomic insert/update to avoid race conditions
78
+ upsert({ var: dynamic_key, value: value.to_yaml }, unique_by: :var)
79
+ clear_cache
80
end
81
82
0 commit comments