johnrees/fablabs

View on GitHub
app/controllers/contributions_controller.rb

Summary

Maintainability
A
25 mins
Test Coverage
class ContributionsController < ApplicationController

  def destroy
    @contribution = Contribution.find(params[:id])
    @project = @contribution.project
    if authorize_action_for @project
      @contribution.delete
      redirect_to project_path(@project), notice: "Contribution deleted"
    else
      redirect_to project_path(@project), notice: "You cannot delete this contribution"
    end
  end

end