From 5752cda86c5eff674dca2b618382dc3edc4a232d Mon Sep 17 00:00:00 2001 From: Ruben Izmailyan Date: Sat, 7 Sep 2024 00:17:39 -0500 Subject: [PATCH] Don't attempt to overwrite readonly attributes --- lib/sprig/seed/record.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sprig/seed/record.rb b/lib/sprig/seed/record.rb index 9c56743..de49cfe 100644 --- a/lib/sprig/seed/record.rb +++ b/lib/sprig/seed/record.rb @@ -32,6 +32,8 @@ def existing? def populate_attributes attributes.each do |attribute| + next if existing? && attribute.name.in?(klass.readonly_attributes) + orm_record.send(:"#{attribute.name}=", attribute.value) end end