Created
April 14, 2011 17:21
-
-
Save buk/919974 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 ReportsController < ApplicationController | |
#before_filter :find_technician | |
def index | |
@reports = @technician.reports | |
end | |
def show | |
@report = @technician.report.find(params[:id]) | |
end | |
def new | |
@report = @technician.report.new | |
end | |
def create | |
@technician.report.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 | |
@report = @technician.report.find(params[:id]) | |
end | |
def update | |
@report = @technician.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 | |
@report = @technician.report.find(params[:id]) | |
@report.destroy | |
redirect_to reports_url, :notice => "Successfully destroyed report." | |
end | |
private | |
def find_technician | |
@technician = Technician.find(params[:technician_id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment