Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created March 8, 2012 18:49
Show Gist options
  • Save jraczak/2002645 to your computer and use it in GitHub Desktop.
Save jraczak/2002645 to your computer and use it in GitHub Desktop.
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