Skip to content

Commit

Permalink
Fix ingredients upgrader for attributes not known on essence
Browse files Browse the repository at this point in the history
There might be data attributes on ingredient classes,
that do not have corosponding attributes on the
essence class.
  • Loading branch information
tvdeyen committed Dec 15, 2022
1 parent 0628b9f commit 9da3ae4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/alchemy/upgrader/tasks/ingredients_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def self.call(element)
ingredient.value = content.ingredient
end
data = ingredient.class.stored_attributes.fetch(:data, []).each_with_object({}) do |attr, d|
next unless essence.respond_to?(attr)
d[attr] = essence.public_send(attr)
end
ingredient.data = data
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/alchemy/elements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
type: Text
default: Hello World
settings:
anchor: from_value
linkable: true
- role: text
type: Richtext
Expand Down Expand Up @@ -301,4 +302,3 @@
- name: key_words
type: EssenceText
group: details

0 comments on commit 9da3ae4

Please sign in to comment.