Class: ParkingClickersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/parking_clickers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
27
28
29
# File 'app/controllers/parking_clickers_controller.rb', line 22

def create
  @parking_clicker = ParkingClicker.new( parking_clicker_params )
  if @parking_clicker.save
    redirect_to new_parking_clicker_path, notice: 'Your changes were saved'
  else
    render :new, error: 'Sorry, your changes could not be saved'
  end
end

#destroyObject



41
42
43
44
45
# File 'app/controllers/parking_clickers_controller.rb', line 41

def destroy
  @parking_clicker = ParkingClicker.find(params[:id])
  @parking_clicker.destroy
  redirect_to parking_clickers_path, notice: 'ParkingClicker deleted'
end

#editObject



31
32
33
# File 'app/controllers/parking_clickers_controller.rb', line 31

def edit
  @parking_clicker = ParkingClicker.find(params[:id])
end

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/parking_clickers_controller.rb', line 5

def index
  @parking_clickers = ParkingClicker.order('identifier')

  if params[:location]
    @parking_clicker_location = Location.find(params[:location])
    @parking_clickers = @parking_clickers.where(location_id: @parking_clicker_location.id) if @parking_clicker_location
  end

  if params[:identifier]
    @parking_clickers = @parking_clickers.where(identifier: params[:identifier])
  end
end

#newObject



18
19
20
# File 'app/controllers/parking_clickers_controller.rb', line 18

def new
  @parking_clicker = ParkingClicker.new
end

#updateObject



35
36
37
38
39
# File 'app/controllers/parking_clickers_controller.rb', line 35

def update
  @parking_clicker = ParkingClicker.find(params[:id])
  @parking_clicker.update_attributes( parking_clicker_params )
  redirect_to parking_clickers_path
end