Removed the requirement of attachment containers having

a project since it is not true for e.g. the Landing Page
plugin
pull/288/head
Sebastian Schuster 11 years ago
parent 6eb1665c48
commit 861ab1750a
  1. 7
      app/controllers/attachments_controller.rb
  2. 3
      app/models/attachment.rb

@ -44,7 +44,12 @@ class AttachmentsController < ApplicationController
@attachment.container.attachments.delete(@attachment)
redirect_to :back
rescue ::ActionController::RedirectBackError
redirect_to :controller => '/projects', :action => 'show', :id => @project
# we cannot be sure the container actually has a project (example: LandingPage)
if @project
redirect_to :controller => '/projects', :action => 'show', :id => @project
else
redirect_to home_url
end
end
private

@ -144,7 +144,8 @@ class Attachment < ActiveRecord::Base
end
def project
container.project
#not every container has a project (example: LandingPage)
container.respond_to?(:project)? container.project : nil
end
def visible?(user=User.current)

Loading…
Cancel
Save