Created
March 8, 2012 18:49
-
-
Save jraczak/2002645 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RequirementsController < ApplicationController | |
before_filter :load_project | |
def create | |
@requirement = @project.requirements.new(params[:requirement]) | |
if @requirement.save | |
redirect_to @project, :notice => "Requirement has been successfully added." | |
else | |
redirect_to @project, :alert => "Warning! This requirement was not saved." | |
end | |
end | |
def new | |
@requirement = @project.requirements.new | |
end | |
def destroy | |
@requirement = @project.requirements.find(params[:id]) | |
@requirement.destroy | |
redirect_to @project, :notice => "Requirement was successfully removed" | |
end | |
private | |
def load_project | |
@project = Project.find(params[:project_id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment