mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
reuse existing attribute value query in serializer
This commit is contained in:
parent
765ec3c217
commit
0c2a8bfa81
@ -113,7 +113,9 @@ class ContentSerializer
|
||||
def value_for(attribute_field, content)
|
||||
case attribute_field.field_type
|
||||
when 'link'
|
||||
page_links = attribute_field.attribute_values.find_by(entity_type: content.class.name, entity_id: content.id)
|
||||
page_links = self.attribute_values.detect do |value|
|
||||
value.entity_type == content.class.name && value.entity_id == content.id && value.attribute_field_id == attribute_field.id
|
||||
end
|
||||
if page_links.nil?
|
||||
# Fall back on old relation value
|
||||
# We're technically doing a double lookup here (by converting response
|
||||
|
||||
Loading…
Reference in New Issue
Block a user