You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
773 B
40 lines
773 B
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
|