Last active
August 2, 2019 18:24
-
-
Save drusepth/6f1d6b24e1cb158a944e589df1c87c5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@linked_entities = [] | |
Rails.application.config.content_types[:all].each do |content_type| | |
@linked_entities += @document.document_entities | |
.where(entity_type: content_type.name) | |
.where.not(entity_id: nil) | |
.includes(:entity, entity: [:universe, :user]) | |
.includes(entity: Rails.application.config.content_relations.fetch(content_type.name, []).map do |relation, data| | |
content_type.instance_methods.include?(data[:with]) ? data[:with] : nil | |
end.compact) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment