Skip to content

Instantly share code, notes, and snippets.

@buk
Created April 14, 2011 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save buk/919709 to your computer and use it in GitHub Desktop.
Save buk/919709 to your computer and use it in GitHub Desktop.
class ReportsController < ApplicationController
def index
@reports = Report.all
end
def show
@report = Report.find(params[:id])
end
def new
@report = Report.new
end
def create
@technician.reports.create(params[:report])
@report = Report.new(params[:report])
if @report.save
redirect_to @report, :notice => "Successfully created report."
else
render :action => 'new'
end
end
def edit
@technician.Report.find(prams[:id])
@report = Report.find(params[:id])
end
def update
@report = Report.find(params[:id])
if @report.update_attributes(params[:report])
redirect_to @report, :notice => "Successfully updated report."
else
render :action => 'edit'
end
end
def destroy
@technician = Technician.find(prams[:id])
@report = Report.find(params[:id])
@report.destroy
redirect_to reports_url, :notice => "Successfully destroyed report."
end
end
#@techn.reports.create(params[:report])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment