diff options
Diffstat (limited to 'app/controllers/parking_stalls_controller.rb')
-rw-r--r-- | app/controllers/parking_stalls_controller.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/controllers/parking_stalls_controller.rb b/app/controllers/parking_stalls_controller.rb new file mode 100644 index 0000000..42931ed --- /dev/null +++ b/app/controllers/parking_stalls_controller.rb @@ -0,0 +1,41 @@ +class ParkingStallsController < ApplicationController + def index + @parking_stalls = ParkingStall.all + end + + def show + @parking_stall = ParkingStall.find(params[:id]) + end + + def new + @parking_stall = ParkingStall.new + end + + def create + @parking_stall = ParkingStall.new(params[:parking_stall]) + if @parking_stall.save + redirect_to @parking_stall, :notice => t('parking_stalls.controller.successfuly_created') + else + render :new + end + end + + def edit + @parking_stall = ParkingStall.find(params[:id]) + end + + def update + @parking_stall = ParkingStall.find(params[:id]) + if @parking_stall.update_attributes(params[:parking_stall]) + redirect_to @parking_stall, :notice => t('parking_stalls.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @parking_stall = ParkingStall.find(params[:id]) + @parking_stall.destroy + redirect_to parking_stalls_url, :notice => t('parking_stalls.controller.successfuly_destroyed') + end +end |