Method: Formstrap::MediaView#attachments
- Defined in:
- app/models/formstrap/media_view.rb
#attachments ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/models/formstrap/media_view.rb', line 75 def if attached.is_a?(ActiveStorage::Attached::Many) result = form.object.send(nested_attribute) # We sort the collection with ruby to prevent a new query to be made that would dispose of the objects in memory result = result.sort_by { |item| item.position } if sort result.to_a.compact else [form.object.send(nested_attribute)].compact end end |