Я пытаюсь создать API, но я получаю сообщение об ошибке
"type": "NameError",
"message": "uninitialized constant Api::V1::ReservationOptionsController::ReservationOptions",
Не могу найти проблему здесь.
Код
маршруты
namespace :api, defaults: { format: :json } do
namespace :v1 do
resources :reservation_options, only: [:show, :create]
end
end
контроллеры / api / v1 /servation_options_controller.rb
class Api::V1::ReservationOptionsController < Api::V1::BaseController
acts_as_token_authentication_handler_for User, only: [:create]
def show
@reservation_option = ReservationOption.find(params[:id])
@reservation = @reservation_option.reservation
authorize @reservation_option
end
def create
@user = current_user
@reservation_option = ReservationOptions.new(reservation_option_params)
authorize @reservation_option
if @reservation_option.save
render :show, status: :created
else
render_error
end
end
private
def reservation_option_params
params.require(:reservation_option).permit(:option_id, :option_quantity, :reservation_id)
end
end