Skip to content

Commit

Permalink
updating routes
Browse files Browse the repository at this point in the history
  • Loading branch information
aradradev committed Oct 29, 2023
1 parent cf8e203 commit 3ed3782
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/cars_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Api::V1::CarsController < ApplicationController
before_action :set_car, only: %i[show update destroy]
skip_before_action :authenticate, only: [:destroy]
skip_before_action :authenticate, only: %i[index show create destroy]

def index
@cars = Car.all
Expand Down
5 changes: 3 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :users, only: [:create, :show] do
resources :cars, only: [:create, :show, :destroy]
resources :users, only: [:index, :create, :show, :destroy] do
resources :cars, only: [:index, :create, :show, :destroy]
resources :reservations, only: [:index, :create, :show, :destroy]
end
post 'login', to: 'authentication#login'
end
Expand Down

0 comments on commit 3ed3782

Please sign in to comment.