Defect #7510 ยป attachments_reverse.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
end
|
||
|
when 'attachment'
|
||
|
attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
|
||
|
if attachments && attachment = attachments.detect {|a| a.filename == name }
|
||
|
if attachments && attachment = attachments.sort_by(&:created_on).reverse.detect {|a| a.filename == name }
|
||
|
link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment},
|
||
|
:class => 'attachment'
|
||
|
end
|
||