Class: Ship::Driver::FavoritesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/ship/driver/favorites_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_driver

Instance Method Details

#destroyObject



23
24
25
# File 'app/controllers/ship/driver/favorites_controller.rb', line 23

def destroy
  @favorite.destroy
end

#editObject



12
13
# File 'app/controllers/ship/driver/favorites_controller.rb', line 12

def edit
end

#indexObject



5
6
7
# File 'app/controllers/ship/driver/favorites_controller.rb', line 5

def index
  @favorites = current_driver.favorites.includes(:user).page(params[:page])
end

#showObject



9
10
# File 'app/controllers/ship/driver/favorites_controller.rb', line 9

def show
end

#updateObject



15
16
17
18
19
20
21
# File 'app/controllers/ship/driver/favorites_controller.rb', line 15

def update
  @favorite.assign_attributes(favorite_params)

  unless @favorite.save
    render :edit, locals: { model: @favorite }, status: :unprocessable_entity
  end
end