Basis of rails-driven app for local business
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

40 lines
773 B

  1. class LoadsController < ApplicationController
  2. def index
  3. @loads = Load.all
  4. end
  5. def new
  6. @load = Load.new
  7. end
  8. def create
  9. @load = Load.new(params[:load])
  10. if @load.save
  11. flash[:notice] = "Successfully created load."
  12. redirect_to loads_url
  13. else
  14. render :action => 'new'
  15. end
  16. end
  17. def edit
  18. @load = Load.find(params[:id])
  19. end
  20. def update
  21. @load = Load.find(params[:id])
  22. if @load.update_attributes(params[:load])
  23. flash[:notice] = "Successfully updated load."
  24. redirect_to loads_url
  25. else
  26. render :action => 'edit'
  27. end
  28. end
  29. def destroy
  30. @load = Load.find(params[:id])
  31. @load.destroy
  32. flash[:notice] = "Successfully destroyed load."
  33. redirect_to loads_url
  34. end
  35. end