summaryrefslogtreecommitdiff
path: root/app/controllers/parking_stalls_controller.rb
blob: 42931ed724b74e4963aed37b8f2d948552a24f23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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