Project

General

Profile

Defect #7510 ยป attachments_reverse.patch

Ernad Husremovic, 2011-02-01 14:09

View differences:

app/helpers/application_helper.rb
663 663
            end
664 664
          when 'attachment'
665 665
            attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
666
            if attachments && attachment = attachments.detect {|a| a.filename == name }
666
            if attachments && attachment = attachments.sort_by(&:created_on).reverse.detect {|a| a.filename == name }
667 667
              link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment},
668 668
                                                     :class => 'attachment'
669 669
            end
    (1-1/1)