class LoadsController < ApplicationController def index @loads = Load.all end def new @load = Load.new end def create @load = Load.new(params[:load]) if @load.save flash[:notice] = "Successfully created load." redirect_to loads_url else render :action => 'new' end end def edit @load = Load.find(params[:id]) end def update @load = Load.find(params[:id]) if @load.update_attributes(params[:load]) flash[:notice] = "Successfully updated load." redirect_to loads_url else render :action => 'edit' end end def destroy @load = Load.find(params[:id]) @load.destroy flash[:notice] = "Successfully destroyed load." redirect_to loads_url end end