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 b4c6a1e commit d62e155
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/alchemy/upgrader/tasks/ingredients_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ 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
1 change: 1 addition & 0 deletions 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

0 comments on commit d62e155

Please sign in to comment.