Merge remote-tracking branch 'remotes/origin/szzh' into develop

This commit is contained in:
nwb 2014-07-25 15:09:56 +08:00
commit c0ac9924e7
1 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ class AttachmentsController < ApplicationController
respond_to do |format| respond_to do |format|
# modify by nwb # modify by nwb
if @attachment.container.is_a?(Course) || @attachment.container.course if !@attachment.container.nil? && (@attachment.container.is_a?(Course) || @attachment.container.course)
if @course.nil? if @course.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
else else
@ -286,7 +286,7 @@ private
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
if @attachment.container_type == 'Course' if @attachment.container_type == 'Course'
@course = @attachment.course @course = @attachment.course
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course elsif !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course)) && @attachment.container.course
@course = @attachment.container.course @course = @attachment.container.course
else else
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'