Class: FreeSlotsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/free_slots_controller.rb

Instance Method Summary (collapse)

Methods inherited from ApplicationController

#authorize_provider!

Instance Method Details

- (Object) create



9
10
11
12
13
14
15
16
17
# File 'app/controllers/free_slots_controller.rb', line 9

def create
  @free_slot = current_user.free_slots.build free_slot_params

  if @free_slot.save
    redirect_to calendar_path, success: 'Free Slot created with success.'
  else
    render 'new'
  end
end

- (Object) destroy



33
34
35
36
37
# File 'app/controllers/free_slots_controller.rb', line 33

def destroy
  current_user.free_slots.find(params[:id]).destroy!

  redirect_to calendar_path, success: 'Free Slot deleted successfully.'
end

- (Object) edit



19
20
21
# File 'app/controllers/free_slots_controller.rb', line 19

def edit
  @free_slot = current_user.free_slots.find(params[:id])
end

- (Object) new



5
6
7
# File 'app/controllers/free_slots_controller.rb', line 5

def new
  @free_slot = current_user.free_slots.build
end

- (Object) update



23
24
25
26
27
28
29
30
31
# File 'app/controllers/free_slots_controller.rb', line 23

def update
  @free_slot = current_user.free_slots.find(params[:id])

  if @free_slot.update free_slot_params
    redirect_to calendar_path, success: 'Free Slot updated with success.'
  else
    render 'new'
  end
end