app/models/concerns/acts_as_attachment_owner.rb
def all_attachment_joins_by_role
    result = {}

    attachment_joins.includes(:attachment).each do |attachment_join|
      role = attachment_join.role || 'default'

      result[role] ||= []
      result[role] << attachment_join
    end

    result
  end
# Returns all attachment joins, grouped by role.
#
# @return [Hash{String, Array<AttachmentJoin>}]
Returns all attachment joins, grouped by role.
Returns all attachment joins grouped by role .
def all_attachment_joins_by_role
    result = {}
    attachment_joins.includes(:attachment).each do |attachment_join|
      role = attachment_join.role || 'default'
      result[role] ||= []
      result[role] << attachment_join
    end
    result
  end
def all_attachment_joins_by_role result = { } attachment_joins . includes ( :attachment ) . each do | attachment_join | role = attachment_join . role || 'default' result [ role ] ||= [ ] result [ role ] << attachment_join end result end
Returns all attachment joins, grouped by role.
Returns all attachment joins grouped by role .
None
Hash{String, Array<AttachmentJoin>}