fix_attachment_test2.diff

Pavel Rosick√Ĺ, 2021-04-04 13:49

Download (615 Bytes)

View differences:

app/models/attachment.rb
370 370
  def self.latest_attach(attachments, filename)
371 371
    return unless filename.valid_encoding?
372 372

  
373
    attachments.sort_by(&:created_on).reverse.detect do |att|
373
    attachments.sort_by{|attachment| [attachment.created_on, attachment.id]}.reverse.detect do |att|
374 374
      filename.casecmp?(att.filename)
375 375
    end
376 376
  end