Skip to content

Commit

Permalink
Ensure symbol values for relations config still work
Browse files Browse the repository at this point in the history
Fixes #965
  • Loading branch information
jaredcwhite committed Dec 22, 2024
1 parent 8d0f89e commit 72e62a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion bridgetown-core/lib/bridgetown-core/resource/relations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def initialize(resource)

# @return [HashWithDotAccess::Hash]
def relation_schema
resource.collection.metadata.relations
@relation_schema ||= resource.collection.metadata.relations&.transform_values do |value|
value.is_a?(Array) ? value.map(&:to_s) : value.to_s
end
end

# @return [Array<String>]
Expand Down
6 changes: 3 additions & 3 deletions bridgetown-core/test/test_relations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class TestRelations < BridgetownUnitTest
"has_many" => "posts",
},
},
"posts" => {
"relations" => {
"belongs_to" => "noodle",
posts: {
relations: {
belongs_to: :noodle,
},
},
},
Expand Down

0 comments on commit 72e62a3

Please sign in to comment.