summaryrefslogtreecommitdiffstats
path: root/app/controllers/attachments_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r--app/controllers/attachments_controller.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 9c0bf15ba..552ff9cff 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -164,8 +164,10 @@ class AttachmentsController < ApplicationController
# Returns the menu item that should be selected when viewing an attachment
def current_menu_item
- if @attachment
- case @attachment.container
+ container = @attachment.try(:container) || @container
+
+ if container
+ case container
when WikiPage
:wiki
when Message
@@ -173,7 +175,7 @@ class AttachmentsController < ApplicationController
when Project, Version
:files
else
- @attachment.container.class.name.pluralize.downcase.to_sym
+ container.class.name.pluralize.downcase.to_sym
end
end
end