diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index f00cbb03d..0aec29e6a 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -181,7 +181,8 @@ class AttachmentsController < ApplicationController respond_to do |format| # modify by nwb - if !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) &&(@attachment.container.is_a?(Course) || @attachment.container.course) + if !@attachment.container.nil? && + (@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) ) if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } elsif @course.nil?